Announcement

Collapse
No announcement yet.

SessionVar for Package Selection by Radio

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SessionVar for Package Selection by Radio

    Can anyone tell me what am I doing wrong here?
    Code:
    -- These actions are performed when the Next button is clicked.
    -- Tip: this is where you could add actions to validate the
    -- user's input before proceeding
    
    if SessionVar.Set("%RadioSelection%", "CTRL_RADIO_BUTTON_01") then
    SetupData.SetPackageProperties("Package01", {Install=true});
    elseif SessionVar.Set("%RadioSelection%", "CTRL_RADIO_BUTTON_02") then
    SetupData.SetPackageProperties("Package02", {Install=true});
    end
    
    -- advance to the next screen
    Screen.Next();
    I have created 2 packages with "Package01" and "Package02" ids, then I insert Radio Button in Screens and put above codes "on Next " Action under Screen Properties but this is not working for me.

  • #2
    Your code is wrong. Please see the example in the help file how you should test which radio button was selected.
    See: Setup Factory Help - Program Reference > Screen Types > Radio Buttons > Example.

    You need to expand the session variable, convert to a number, and then compare that number with the constants CTRL_RADIO_BUTTON_01, CTRL_RADIO_BUTTON_02 (which are numbers, not strings, so they should not be used with quotes), and so on.

    Ulrich

    Comment


    • #3
      Originally posted by Ulrich View Post
      Your code is wrong. Please see the example in the help file how you should test which radio button was selected.
      See: Setup Factory Help - Program Reference > Screen Types > Radio Buttons > Example.

      You need to expand the session variable, convert to a number, and then compare that number with the constants CTRL_RADIO_BUTTON_01, CTRL_RADIO_BUTTON_02 (which are numbers, not strings, so they should not be used with quotes), and so on.

      Ulrich
      Thanks for the help. It worked.

      Comment

      Working...
      X
      😀
      🥰
      🤢
      😎
      😡
      👍
      👎