Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

paul102384 (Programmer)
23 May 08 7:33
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...
Helpful Member!(2)  thekl0wn (Programmer)
23 May 08 10:09
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( )
paul102384 (Programmer)
24 May 08 3:13
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....  
Helpful Member!(2)  bernds44 (Programmer)
26 May 08 7:31
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)

 

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close