Expand my Community achievements bar.

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

New to Lifecycle - need direction on if... then... else

Avatar

Level 1

First off; i hope this is the correct place to ask this question, so if not, please let me know where to post.

I am using LC designer 8, and having an issue with the if... then... else. statement

i am writting a script using FormCal --> calculate the code below is what i need to do.  The issue that i am running into is that the code only performs one (1) of the actions under the then/else statement, is there a seceret to having more than one statement under the then / else -

This code is behind a barCode field if that makes a difference, seems if i comment out the presence statements the values are set correctly, but not the presence.

if

  (Text2.rawValue == 0)

then

   $.presence = "invisible"

   $.rawValue

= Text2.rawValue

else

   $.presence = "visible"

   $.rawValue

= Text2.rawValue

endif

thanks for your help.

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Save your form as a dynamic form and it will work.

Paul

View solution in original post

6 Replies

Avatar

Former Community Member

Can you post your form so we may have a look?

Paul

Avatar

Level 1

Attaching file w/ only the two fileds affected; since the last post, i have played around with the print only options of the presence; but the issue with this is that the logic doesnt seem to work all the time; sometime the value will show and other time is does not.

Avatar

Former Community Member

Seems to work fine for me. Which version of Acrobat are you testing with?

Paul

Avatar

Level 1

I am using the "preview" tab and the viewer {version 8] to text. from what i see the setting of the values work with no issue, but the presence does not. - i can see this when i comment out the , BC.relevant = "+print" line of code.

When i first bring it up, the value is SS_text null - thus the barcode should not be visable on the screen, when i populate the SS_text, the barcode should be shown; but it does not appear for me, is it working for you that way ?    should i be doing somthing like the code below instead of the way i was,  i still cant get the barcode to show with it either.

if

(SS_Text

<> null)

  then

    BC.presence

= "visible"

    BC

= SS_Text

else 

//is null

   BC.presence 

= "hidden"

   0

endif

Avatar

Correct answer by
Former Community Member

Save your form as a dynamic form and it will work.

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