Solved

Calculated Date Field in Dw

Posted on 2006-06-15
5
333 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
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.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

920 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

17 Experts available now in Live!

Get 1:1 Help Now