pjohns
4th January 2013, 12:26
Hello,

I'm sure this will be very easy to solve for you experts.

I have a case statement which checks the company number from which a document is printed from. If company = 208 and the document type = 210 then select a layout. If the document type <> 210 then use default layout.
If company <> 208 then use other case statement.

I am printing from company 208, document <> 210 so I would expect the STD-IRE-MS.pdf and TAC-SALE.pdf to be used. But this is being ignored and going to the case "MAC" section.



fd.back = ""
fd.tac = ""
fd.stamp =""
on case comp
case 208:
|* Layout for 208 PO
on case i.doct
case 210: |*Purchase Order
fd.back = "PUR-MSL.pdf"
fd.tac = "TAC-PUR.pdf"
break
default: |* Sales Layouts
fd.back = "STD-IRE-MS.pdf"
fd.tac = "TAC-SALE.pdf"
break
endcase
break
endcase


on case i.cotp
case "MAC":
fd.back = "STD-UK.pdf"
fd.tac = "TAC-SALE.pdf"



Thanks in advance

PJ

JaapJD
4th January 2013, 13:56
Before the 2nd case statement you should write a condition: if isspace(fd.back) then...

pjohns
4th January 2013, 14:30
Thanks Jaap,

This worked thank you. But can you explain why a break does not work inthis instance? I thought a break in a case statement stops all other cases being executed??

JaapJD
4th January 2013, 14:39
'break' breaks one level. So it continues after the 'endcase'. The same applies when you have nested for/endor or while/endwhile loops, and also in the selectdo.