Skip to Content
0
Former Member
Oct 13, 2009 at 09:23 PM

trying to create a nested if

15 Views

I used this formula,

Local StringVar docType := {L_HPLI.OBJECT}[6To 6];

Local StringVar Comment1 := {L_HPLI.OBJECT}[96 To 256];

If docType In ["P", "p"]

and ({POLINE.L_INDEX} = {L_HPLI.L_INDEX})Then

Comment1

Else

"";

It works if there is a comment stored in L_HPLI. If there is no comment stored in L_HPLI then the value of POLINE.L_INDEX four spaces.

I tried placing the above lines in a IF statement.

If (Len ( Trim (POLINE.L_INDEX)) > 1 ) Then

Local StringVar docType := {L_HPLI.OBJECT}[6To 6]

Local StringVar Comment1 := {L_HPLI.OBJECT}[96 To 256]

If docType In ["P", "p"]

and ({POLINE.L_INDEX} = {L_HPLI.L_INDEX})Then

Comment1

Else

""

Else

"";

I was trying to trim the spaces (there are 4) and check the result for a length of greater than 1, if there is a value in the string I want to use the formula. If the string is just spaces, I don't want to use the formula, but I do want to return a blank to the report.

I hope this makes sense.

Can anybody help?