manusatsangi
19th September 2002, 14:31
Hi,
With Maintain and Display sessions, I have found "Query by Form" very useful in selecting the relevant data.
For e.g., if I wanted to get a domain which represents month no, I opened session "Display Domains" and in Query by Form, I specified

Description like .*Month.*

It gives me all the domains having "Month" as substring in the description of the domain.
But I have also found out that not all features of regular expression are possible here.
For e.g., if I want all domains description of which end by letter 'e' and I write

Description like .*e

yields me no result at all.
Can anyone throw light on this aspect that how can I query using "Query by form" for a field
1) Starting by a specified character or string
2) Ending by a specified character or string
3) is 'n' character long
etc... and any other regular expression features.

evesely
19th September 2002, 16:11
I think the problem is that even though we might think that an item code of say 'ITEM1' is five characters in length, it really is 16 (or whatever your domain length is). So in this case, my item code has 11 spaces after 'ITEM1'.

**NOTE: If you are using a right-aligned field, these won't work. You'll have to re-think your logic based on spaces being prefixes rather than suffixes.

Thus, I would code your expressions as listed below. Here, x is the desired character or string. Also, since spaces are hard to discern, a space will be shown as sp .
[list=1]
Char/String at start: like x.*
Char/String at end: like .*xsp*, where the ending character/string is followed by a space and then an asterisk.
Length of n. This isn't really clean, but it does work. Use the period (.) n-1 times, and follow by the sequences [^sp] (chevron and space within square brackets) and then a space and an asterisk. For example, for five characters, use like ....[^sp]sp*
[/list=1]

Good luck!

manusatsangi
20th September 2002, 07:32
Hi evesely,
Thanks for the solution

They all work very well, but they are not documented anywhere. In fact, regex rules state that end of expression is represented by $, but here is it represented by <space>*

Thanks a lot anyway.

Warm Regards
Manu

evesely
20th September 2002, 15:35
I originally tried using $ too, but I think the spaces at the end prevent that from working. I think the same applies to start (^). You would think ^A would give you everything starting with A, but it doesn't. You have to give the .* after it, in which case you can drop the ^ anyway.

Fun, fun, fun.

~Vamsi
20th September 2002, 18:52
Check http://www.baanboard.com/programmers_manual_baanerp_help_functions_expressions_runtime_expr_compile for regex support in Baan.

Manu, Baan's regex works similar to unix regex. The reason why the $ fails is a more basic one. All strings in Baan are fixed length. So they get padded with spaces on one of the sides. When writing regexes you will have to take that into consideration.