0

Why is my switch statement always returning the default value.

Hi all,

I have the below code attached to a button, when i click the button it should used the choice from the drop down to append the suffx to the filename before saving it into the attachments.

For some reason I cant get to bottom of why it only ever appends "PDF" no matter what the choice value is in the dropdown.

let formToPrint := text('Print Layout Choices');
let docSuffix := "";
switch 'Print Layout Choices' do
case 2:
(docSuffix := "OrderForm")
case 3:
(docSuffix := "OrderForm")
case 4:
(docSuffix := "OrderForm")
case 5:
(docSuffix := "OdlingsOrder")
case 6:
(docSuffix := "OdlingsOrder")
default:
(docSuffix := "DPF")
end;
importFile(this, printAndSaveRecord(this, formToPrint), 'Order ID' + "-" + docSuffix + ".pdf")

 

Any help will be greatly appreciated.

 

Craig

2 replies

null
    • Mconneen
    • 4 yrs ago
    • Reported - view

    Just a total SWAG ..   (Scientific Wild A** Guess) .. 

    Try 

    switch number('Print Layout Choices')

    • Craig
    • 4 yrs ago
    • Reported - view

    Ha it works, really appreciate that!! No more download rename upload ..

Content aside

  • 4 yrs agoLast active
  • 2Replies
  • 1363Views