cancel
Showing results for 
Search instead for 
Did you mean: 

expression must match error

Former Member
0 Kudos

I am building a search expression for one of my data window, below is the code i am using:

ls_dr_no = string(ld_dr_no)

ls_posting_date = string(ld_posting_date)

ll_rowfound = a_dw.find('dr_no="' + ls_dr_no + '" and audit_posting_date="' + ls_posting_date + '"',1,a_dw.rowcount())

a_dw has both columns dr_no and audit_posting_date in it. When I use the above expression I get an error message that expression types must match. If I try to build string with ld_dr_no(decimal datatype) and ld_posting_date (date datatype) the program won't even compile beause compiler tells me that I am building a string by concatenating date or decimal datatype to it. Is not possible to search thru the datawindow columns whose datatype is other then string? If it is how do I build my search string? Can someone please help. Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I was getting messages back from this site that your message has been approved by our moderator but I could not see my thread in content so I thought there was a problem with the website as there were issues encountered recently so I go a little impatient and posted this post in sybase newsgroups as well, sorry for the duplication but it is the same question.

former_member190719
Active Contributor
0 Kudos

Just responded to the earlier post.  Go ahead and mark this one answered.  You might select your last reply as the 'correct' answer.

Answers (2)

Answers (2)

Former Member
0 Kudos

Correct Syntax could be this:

s_dr_no = string(ld_dr_no)

ls_posting_date = string(ld_posting_date)

ll_rowfound = a_dw.find('dr_no=' + ls_dr_no + ' and audit_posting_date="' + ls_posting_date + '"',1,a_dw.rowcount())

Former Member
0 Kudos

Always, always, always use a number higher than the rowcount in a find.  EX: a_dw.rowcount() + 1

Former Member
0 Kudos

Thanks to everyone for their contribution, all good suggestions. However becasue of some mixup some of the really helpful answers to this question are not there anymore but answers by for exmaple answers by Bruce and Jerry Siegel are not here anymore but they pointed out a very important factor about using format for date column.

former_member190719
Active Contributor
0 Kudos

They're still here.  If you're using the "Communications" page, you can click the show earlier link to see all of the replies.   Otherwise, it just shows you the most recent.

Former Member
0 Kudos

Any specific reason?

Former Member
0 Kudos

Start by entering the expression in the DW Painter IDE.  That's the easiest way to get the syntax right.  Then convert that into your code.

It needs to end up looking something like:

find("dr_no = 'abc' and audit_posting_date = date('2013-03-22')")