rdbailey
28th April 2005, 22:53
Hi all,

I am trying to reference "subscripted" fields in tdsls041 for a report. I can't seem to get the indexing correct to be able to look at the subscripts of each field correctly. Here is the code I currently have:

for indx = 1 to 3
if tdsls041.disc(indx) <> 0 or tdsls041.ldam(indx) <> 0 then
detail.line = ""
if tdsls041.disc(indx) <> 0 then
detail.line = detail.line & sprintf$("%9.2f",tdsls041.disc(indx))
endif
if tdsls041.ldam(indx) <> 0 then
detail.line = detail.line & sprintf$("%9.2f",tdsls041.ldam(indx))
endif
discount.code = tdsls041.cdis(indx)
| discount.code = temp.code((indx-1)*3-2;3)
if strip$(discount.code) > "" then
get.tcmcs021.details(discount.code)
detail.line = detail.line & tcmcs021.dsca
else
detail.line = detail.line & "Dist Allowance"
endif
if tdsls041.disc(indx) < 0 or tdsls041.ldam(indx) < 0 then
detail.line = detail.line & " - Charge"
endif
print.detail.line()
endif
endfor


My current problem is the assignment "discount.code = tdsls041.cdis(indx)". I get errors for this field, but not for disc nor for ldam. I have tried playing around with strings to extract the values, but that doesn't seem to be working either. Any thoughts or suggestions would be greatly appreciated.

lbencic
28th April 2005, 23:49
The problem is that the cdis is a string, so the way you reference the element has to be different. For numeric (disc & ldam), you just refer to it as:

tdsls041.disc(1)
tdsls041.disc(2)
tdsls041.disc(3)

as you have done. But for strings, you need:

tdsls041.cdis(1,1)
tdsls041.cdis(1,2)
tdsls041.cdis(1,3)

The first 1 means, start at position 1. This Wiki link (http://www.baanboard.com/programmers_manual_baanerp_help_3gl_features_arrays) explains (sort of).

rdbailey
29th April 2005, 00:17
The problem is that the cdis is a string, so the way you reference the element has to be different. For numeric (disc & ldam), you just refer to it as:

tdsls041.disc(1)
tdsls041.disc(2)
tdsls041.disc(3)

as you have done. But for strings, you need:

tdsls041.cdis(1,1)
tdsls041.cdis(1,2)
tdsls041.cdis(1,3)

The first 1 means, start at position 1. This Wiki link (http://www.baanboard.com/programmers_manual_baanerp_help_3gl_features_arrays) explains (sort of).


Thank you Lisa! That did the trick. I have just never run across having to use that before. Thank you again.