Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datawindow (Filter) 4

Status
Not open for further replies.

paul102384

Programmer
Oct 5, 2007
30
0
0
hi to all PB programmers:

In datawindow, how can i filter all the data with a month of january and with the year 2001 (regardless of days specified) if the selected criteria for Month is January and for Year is 2001.Assuming the equivalent
value for January is 1.

the data that was retrieve in the datawindow are:

Date
02/04/2007
01/08/2001
02/05/2004
01/09/2001
01/12/2001


and the output that i want should be look like this:

Date
01/08/2001
01/09/2001
01/12/2001

tnx in advance...
 
Call an event with something like this:

String ls_filter

//supposing the column with the date is called "some_date"
//also assuming that some_date is of date or datetime type
ls_filter = "Year( some_date ) = 2001 AND Month( some_date ) = 1"

dw_test.SetFilter( ls_filter )
dw_test.Filter( )
 
tnx thekl0wn, the code absolutely works....

but, theres a problem when i'm trying to move the value's 2001 and 1 for january into a variable...

i've try this code but it doesn't work and it say's that "expresion is not valid"

the code looks like this:


String ls_filter
integer li_year,li_month

li_year = 2001
li_month = 1

ls_filter = "Year( some_date ) = li_year AND Month( some_date ) = li_month"

dw_test.SetFilter( ls_filter )
dw_test.Filter( )

can u pls help me to fix this problem...
tnx in advance....
 
Hi,

you cannot use a variable inside a string-constant. how could any compiler know how to interprete the code? the compiler (parser) cannot know if you want the content of a variable inside the string or if you want to have the characters inside the string.
use

ls_filter = "Year( some_date ) = " + string( li_year) + " AND Month( some_date ) = " + string( li_month)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top