Solved

Calculated Date Field in Dw

Posted on 2006-06-15
5
336 Views
Last Modified: 2013-12-26
How can I do the calculated date  in the dw with Computed  field.
I have a Computed Field where I calculate the number of months the item expire in.
Now, based on that I need to report the month when the part expire.


Ex.
Remaining Hours 400
Remaining Months 400/180 ( 180 часов в месяц хардкодед)= 2
Expire Months 2

Expire Date needed Todays date + 2 months = August, 2006...

How to do the calculations for the date.
In SQL I could do the Dateadd, but how do I do that in Dw.

thanks

0
Comment
Question by:Namik48075
  • 2
  • 2
5 Comments
 
LVL 4

Expert Comment

by:Lordain
ID: 16914587
Look at the RelativeDate Function.
0
 

Author Comment

by:Namik48075
ID: 16914696
Thank you,

Is the relative date only works with days, is it possible something like thins for months?
0
 
LVL 4

Accepted Solution

by:
Lordain earned 250 total points
ID: 16915155
If you are only after the month then Try this:

Long ll_month

ll_month = Month ( Today( ) ) // Should return the Month of the Today( June = 6)

Now all you need to do is add 2 to the return value.  You will likely need logic to handle the case if you exceed month 12 but that should be easy.

ll_month + 2

You can also do Year ( Today( ) ) should you want to involve years too.
0
 
LVL 8

Expert Comment

by:gajender_99
ID: 16921407
you can try this

 If((400/180)+2>12,13 - (400/180)+2, (400/180)+2) make a compute filed with the name c_month
The creat another computete file like this

If(c_month=1,’Jan’,if(c_month=2,’Feb’, if(c_month=3,’March’, if(c_month=4,’April’, if(c_month=5,’May’, if(c_month=6,’june’, if(c_month=7,’July’, if(c_month=8,’August’, if(c_month=9,’Sep’, if(c_month=10,’OCT’, if(c_month=11,’Nov’, if(c_month=12,’DEC’,))))))))))))
0
 
LVL 8

Expert Comment

by:gajender_99
ID: 16921417
sorry for mistyping

you can try this

 If((400/180)+2>12,13 - (400/180)+2, (400/180)+2) make a compute filed with the name c_month and hide it
Then creat another computed filed like this

If(c_month=1,’Jan’,if(c_month=2,’Feb’, if(c_month=3,’March’, if(c_month=4,’April’, if(c_month=5,’May’, if(c_month=6,’june’, if(c_month=7,’July’, if(c_month=8,’August’, if(c_month=9,’Sep’, if(c_month=10,’OCT’, if(c_month=11,’Nov’, if(c_month=12,’DEC’,))))))))))))
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
HTML/Webpage Editor for Windows 10 20 165
In Notepad++ how to tell if tab files have been changed? 4 64
Java Help 2 85
Visual Studio 2013 and Eclipse Neon 6 37
In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand columnThat will then direct you to their download page.From that page s…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question