Expand my Community achievements bar.

SOLVED

"Else" error

Avatar

Level 4

Good Morning,

I have been doing if/else if scripting scripting on a form and it was working pretty well.  I then had a scenario where multiple fields had to appear or not and I set them up the same way as I had in other ones and they won't work.  I get an error saying I've used "else" incorrectly  I've tried with field names and with subforms.  Any suggestions on what I can do to correct it?  I've uploaded a file with two examples of what I'm trying to do, the first uses the subforms in the script and the second uses the fields.

Thanks!

https://acrobat.com/#d=-NCGILkZZ4OUkCEpBFO-qg

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

You just need the } and { to emclose your if sections .....see my modifed version of your form att

ached.

Paul

View solution in original post

6 Replies

Avatar

Correct answer by
Former Community Member

You just need the } and { to emclose your if sections .....see my modifed version of your form att

ached.

Paul

Avatar

Level 4

Thanks!  I do have one more question.  Do I need the brackets on this particular script because there is so much more info?  I didn't have to use it on any others and they worked fine, including one that had multiple fields?

Avatar

Level 4

I just discovered one problem.  If I select Yes and then select No because I changed my mind the options for Yes stay visibile.  Ther reverse is also true.  If I select Select One everything goes away like it should.  Any thoughts on how to fix this?

Avatar

Former Community Member

If the if section has more than one statement then yes you need them .....I always put them in ...it helps me to see the logic flow.

paul

Avatar

Former Community Member

The logic in your form does not hide anything ...it simply shows things as required. If Yes and No do different things then you will have to

also add code to hide the parts that you do not want to show.

Paul

Avatar

Level 4

Thanks!  Not it all works.  I appreciate the help!

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----