en@frrom
24th June 2005, 13:41
I have a multi-occ display session, in which the user enters search arguments on top half of screen, and results are immediately displayed (upon hitting tab on each field) in the bottom half of the screen. So what I do in the script is a query.extend.where and a rebuild.query/execute.first.set after each search field.

So far I didn't enable wildcards, i.e. table field contains "ABCDEFGHI" and user enters "AB" gives result, but if user enters "BC" it doesn't give result. Now there was a request to enable wildcard.

I know there normally is an option to use pos(), but can I get this working also with my query.extend.where clause? Same thing with LIKE operator; I have no idea how I can get that working; made several attemps, so far no result...

Here is part of my code:

nama = strip$(shiftl$(nama))
set.max(nama.t)
nama.t = nama & nama.t

query.extend.where("tccom100.nama inrange :nama and :nama.t" &
" and tccom100.seak inrange :seak and :seak.t" &
prst.string &
" and tccom100.fovn inrange :fovn and :fovn.t" &
" and tccom100.cadr refers to tccom130" &
" and exists (select tccom110._index1" &
" from tccom110" &
" where tccom110._index1 = {:tccom100.bpid})" &
" and tccom130.namc inrange :namc and :namc.t" &
" and tccom130.hono inrange :hono and :hono.t" &
" and tccom130.name inrange :name and :name.t" &
" and tccom130.pstc inrange :pstc and :pstc.t" &
" and tccom130.ccty inrange :ccty and :ccty.t")

vahdani
24th June 2005, 14:01
Hi,

this works in Baan IV:

query.extension = "tdsls001.seak like " & chr$(34) & ".*" &
strip$(shiftl$(search.seak))& ".*" & chr$(34)


You should be able to use something similar in Baan V.

en@frrom
24th June 2005, 14:35
Great Vahdani, this works perfectly! Just the explanation I am still not sure of?? I guess it has to do with the following: Baan translates the queries to the database (driver), and retrieves the result based on conditions, except for LIKE operator, which is only re-filtered within Baan after being fetched from the database. So there might be a conflict between the string closing tags, i.e. " or '.... Does it have to do with this???

vahdani
24th June 2005, 16:01
Hi,

I suppose the reason is that the comiler cannot deal with or understand a line like this:


query.extension = "tdsls001.seak like ".*" &
strip$(shiftl$(search.seak)) & ".*""

SanttuP
7th July 2005, 12:58
I have tried and tried but cannot get like-expressions to work when session is running. If I initialize the variable in before.program, before query.extension it works fine, but any change in variable value doesn't have any effect. This only happens for the like-expressions. All the other work fine with calling refresh() after initializing variable value.
I have also tried calling execute(first.set) and execute(find.data) but no success.
Any ideas ? Baan IVc4

vahdani
7th July 2005, 13:02
Hi,

use the function rebuild.query().


query.extension = "......."
rebuild.query()
execute(find.data)

SanttuP
7th July 2005, 17:23
Thanks!
Me dummy. I already saw use of rebuild.query in earlier posting, but it obviously didn't exist in my help-file/Scite-keyword-list (scite by the way is excellent editor, thanks a lot for this forum for finding it). It didn't highligt and I thought then that it must be Baan V funtions. Should've thought twice :rolleyes:

mark_h
7th July 2005, 17:50
There are a few commands that do not get highlighted using the scite editor. You can fix it by adding them into your baan.properties file. Just follow the syntax formatting - not hard.