scough
28th July 2011, 18:37
I have the following code in a Parameter Substitution Constraint..
!table ttipcf900
tipcf900.type = " " & [SERIESMO]
tipcf900.dend = [DRIVE_OP]
tipcf900.nimp = [N_STAGES]
tipcf900.lube = [LUBEOPTI]
!db.eq(ttipcf900)
item_data = tipcf900.item
As you can see I am pre-pending a space to the [SERIESMO] product feature value.
Is there a function that I can use to either pad the [SERIESMO] with leading spaces according to the char length of the type field, or is there a STRIP function I can use to strip the leading spaces from the tipcf900.type value for the compare test?
Thanks
mark_h
28th July 2011, 18:41
Checkout strip$, shiftl$, shiftr$. I seem to recall something to pad spaces, but cannot remember it off the top of my head.
ashishjain
28th July 2011, 22:16
strip$() function returns the string without trailing spaces but not the leading spaces. As suggested by Mark you can use the below code to solve your problem. This will return the string without any leading or trailing spaces.
strip$(shiftl$(your string))
scough
29th July 2011, 03:11
I am not sure strip$(shiftl$(string)) would work. if you strip then you can't shift (there are no white spaces to accommodate the shift).
Keep in mind that the [SERIESMO] is coming in stripped already (it wont take leading spaces in the input). When the user inputs C5 into the [SERIESMO] feature field there are no leading or trailing spaces. (I had to prefix the user input with a space to match tipcf900.type data type of char(3).
If I am to use the strip function it has to be on the table value side. Will that work?
For example, this line of code:
tipcf900.type = " " & [SERIESMO]
can be replaced by this line of code
strip$(tipcf900.type) = [SERIESMO]
When db.eq is fired will go to the row where the tipcf900.type column contains “ C5” and the user input is “C5”?
ashishjain
29th July 2011, 08:30
you can use function tt.align.according.domain(...)
For more info you can refer the below link..
http://www.baanboard.com/programmers_manual_baanerp_help_functions_string_operations_tt_align_according_domain
scough
29th July 2011, 22:38
I will experiment with that but this still may not work according to the documentation:
The input string. This must have the same length as the specified domain. If it is longer than the domain, its final characters are ignored.
The input string will not be at, all times, the same length as the domain. If it was the same length I wouldn't be having this problem :)
vahdani
31st July 2011, 08:53
Table string fields are "Fixed" in lenght. Fill the table field first and then shift its content to the right:
!table ttipcf900
tipcf900.type = [SERIESMO] |Fill field first
tipcf900.type = shiftr$(tipcf900.type) |Now shift content
tipcf900.dend = [DRIVE_OP]
tipcf900.nimp = [N_STAGES]
tipcf900.lube = [LUBEOPTI]
!db.eq(ttipcf900)
item_data = tipcf900.item