I have a list of over 900 items, so I am trying to use a variable for the field value I need. I have given the SubstationName field the variable name sub. What is happening is the if statement works, and if the field is empty I get the alert. But it is also submitting. I need it to not submit unless the SubstationName field has a value.
And a second part, can the same variable be used in the save path name? I would like to go down another level of folder for each substation chosen so that each PDF is saved in a folder for that sub. It works as is and saves to the /c/SPCC/ folder, but I would like to go to, for example, /c/SPCC/Acton/
Thanks in advance.
var sub = SPCC.Body.TitleBlock.SubstationName.rawValue
if (sub == null) {
app.alert("You must select a substation before you can save the file.");}
else (sub != null) {
xfa.resolveNode("SaveAsName");
myTrustedSpecialTaskFunc(this, "/c/SPCC/" + SPCC.Body.TitleBlock.SubstationName.rawValue + " " + SPCC.Body.TitleBlock.CurrentDate.rawValue + ".pdf");
app.alert("Your file has been saved as: " + SPCC.Body.TitleBlock.SubstationName.rawValue + " " + SPCC.Body.TitleBlock.CurrentDate.rawValue + ".pdf.","3");}