RalphBaan
26th April 2002, 13:13
I am looking for a sql command that does the same as strip$.
I have a select statement in which I compare a table field with a form field. I need to strip$ the table field.
Does anyone know a sql command?

Grtz. Ralph

RalphBaan
26th April 2002, 13:37
select tiitm012.*
from tiitm012
where tiitm012.citt = " 00"
and tiitm012.aitc = :tiitm900.aitc
as set with 1 rows
selectdo
doorgaan = true
tiitm900.citt = " 00"
selectempty
doorgaan = false
endselect

I would like to change line 'and tiitm012.aitc = :tiitm900.aitc'
to 'and strip$(tiitm012.aitc) = :tiitm900.aitc'

Youp2001
26th April 2002, 13:55
There is no such command within Baan SQL. Why don't you give your formfield the same domain as the table field and declare the field in your script as fixed (so fixed length). In that case you don'tn need to strip the table field.

Success.

Youp

RalphBaan
26th April 2002, 13:58
That doesn't work because I use the formfield with different table fields with different domains.

gentercz
26th April 2002, 14:32
The TT.ALIGN.ACCORDING.DOMAIN function aligns a string string_in
to a string string_out, according the align method of the domain:
left, right or centered. string_out and string_in must be a
string with the length of the specified domain. string_in may
also be longer than the domain length, but in that case only the
first part of the string_in is taken into account. The function
returns 0 (result okay) or -1 (domain not found or the type of
the domain is not string/multibyte string).


Examples:
table ttiitm001
domain tcitem item
long ret

item = " XY"
ret = tt.align.according.domain(item, tiitm001.item, "tcitem")
| Result tiitm001.item (if left adjusted): "XY "

plus: you have to include #include <bic_tt>

thus you can preformat your string to a given domain. works extremly well ...

try it!
jochen

NPRao
26th April 2002, 20:42
I dont know exactly what are you trying to do, maybe you need explain more...

There are few possible solutions as other suggested... I have one suggestion -

You can get the length of your string variable and then do a selectbind or a wherebind with respect to its length.

From the manual -

In order to bind pseudo variables, the functions SELECTBIND and WHEREBIND have been added. Pseudo variables have the form ':<number>'. A special bind function is then used to link a program variable to the pseudo variable. For example:

SELECT ppmod123.field1:5, ppmod123.field2:6
SELECTBIND(5, my_val1)
SELECTBIND(6, my_val2)
SELECTDO
....

ENDSELECT

This is equal to 'SELECT ppmod123.field1:my_val1', but using a bind function.
It is also possible to use a pseudo variable in the WHERE clause. The WHEREBIND function is then used to link a value to the pseudo variable. For example:

SELECT ....
WHERE ppmod123.field1 = :1
WHEREBIND(1, 10 + sqrt(a+b))
SELECTDO
....

ENDSELECT

Used BAAN 4GL variables (with ':') are 'bound' automatically.