AnsweredAssumed Answered

Global Variables are an Epic Fail

Question asked by rickaltman on Jan 17, 2019
Latest reply on Jan 17, 2019 by PeterDoern

I seem to be doing something fundamentally wrong with my attempt to create an invoicing script. I have a layout that can create either an invoice or a receipt and I have conditional formatting established to branch in either direction. But I can't seem to define the variable properly that triggers the branching. Here are my script steps:

 

-------------------------

Show Custom Dialog [ Title: "Receipts & Invoices"; Message: "Choose one"; Default Button: “Invoice”, Commit: “Yes”; Button 2: “Receipt”, Commit: “Yes”]

 

If [ Get (LastMessageChoice) = 1 ]

Set Variable [ $$INVREC; Value:"Invoice" ]

 

Else If [ Get (LastMessageChoice) = 2 ]

Set Variable [ $$INVREC; Value:"Receipt" ]

 

Show Custom Dialog [ Title: "You chose $$INVREC"; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]

-------------------------

 

The second custom dialog is in place just for testing purposes and it displays the literal message "You chose $$INVREC." In other words, the variable is not being defined and populated and I can't figure out why. Any help would be appreciated.

Outcomes