Solved

Calculated Date Field in Dw

Posted on 2006-06-15
5
331 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
Comment Utility
Look at the RelativeDate Function.
0
 

Author Comment

by:Namik48075
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
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.

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now