Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Syntax error with formcalc

Avatar

Level 1

I am using the code below to convert a numbered dropdown menu into a long text field:

form1.#subform[0].TextField1[0]::calculate - (FormCalc, client)

if (DropDownList2[2] eq "N/A") then

     TextField1[0] = ""

elseif (DropDownList2[2] eq "1") then

     TextField1[0] = "one long text"

elseif (DropDownList2[2] eq "2") then

           TextField1[0] = "two long text"    

endif

My problem is that the field works correctly but I am getting this error message:

Script failed (language is formcalc; context is

xfa[0].form[0].form1[0].#subform[0].TextField3[1])

script=if (

Error: syntax error near token '(' on line 3, column 0.

Any help you could provide would be greatly appreciated.

Thanks

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Your code looks fine to me .....the error is indicating that the issue is on TextField3 but you have shown us the code on TextField1 .....is the code on TextField3 different?

Paul

View solution in original post

3 Replies

Avatar

Correct answer by
Former Community Member

Your code looks fine to me .....the error is indicating that the issue is on TextField3 but you have shown us the code on TextField1 .....is the code on TextField3 different?

Paul

Avatar

Level 10

The error massage is related to Textfield3 not Textfield1, so the script above isn't the problem.

There must be a script in Textfield3 which is wrong.

Avatar

Level 1

Sorry when copied the pulldown menu I must of already started writing the code on the master pulldown. 

Thanks Paul

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] ----