Checkbox with string output

  • Ralf Hader
        3 years ago #25399

        Hello there,

        I need a simple version of  checkbox to string.

        my current version is:

        {variableHolder>/USER_STRUCT/allowed} in Checkbox selected and

        {= ${variableHolder>/USER_STRUCT/allowed} ? 'X' : ''} in Checkbox key

        now i´m able to make an UIAction with binding the widget.checkbox.key to my output variable or whatever…

        the question is: is there an option to use this without the STRUCT… how is the syntax if i want to change only the value of key to  X or not?

        if checkbox selected -> key = X

         

        thx

        Vitali Kurdasov
            Has successfully completed the online course Intermediate (200)
            Has successfully completed the online course Basics (100)
            Has successfully completed the online course Advanced (310)
            Has successfully completed the Intermediate Certification
          3 years ago #25414
          Up
          1
          Down
          ::

          Hi Ralf,

          I’m sorry to tell you that it’s not going to work out the way you want it to.

          UI5 doesn’t provide any way to access the current element or its properties in expression/property bindings, since they are included in the View.json.

          If you just don’t want to use your USER_Struct variable for the binding, a possible alternative could be to write the values of the selected property of each checkbox into a view model and then reference the model path in the binding of the key property of the respective checkbox in the UI Designer. For this you need to take care of initializing the view model first though.

          If you want to have an example of the ‘ViewModel’ solution, I’ll be happy to provide you with one.

          As another option you could add a formatter function to the property binding of ‘selected’ for each checkbox but again, this would rely on scripting and usage of model binding.

          Regards,

          Vitali

          Vitali Kurdasov
              Has successfully completed the online course Intermediate (200)
              Has successfully completed the online course Basics (100)
              Has successfully completed the online course Advanced (310)
              Has successfully completed the Intermediate Certification
            3 years ago #25400
            Up
            0
            Down
            ::

            Hey Ralf,

            you can simply configure it in the Process Designer like in the Screenshots below.

            If the condition is true i set the key to ‘X’ through a constant, otherwise i set it to ”

            I hope it helps you out.

            Attachments:
            You must be logged in to view attached files.
            Ralf Hader
                3 years ago #25404
                Up
                0
                Down
                ::

                Thx Vitali,

                but that’s the other direction.

                I want the X in the key field without any process logic. i have more than 20 checkboxes to fill and every condition to select makes it more lowly

                {= ${variableHolder>/USER_STRUCT/allowed} ? 'X' : ''} <– this is the way i want to go (see checkbox-key)

                But this one is looking for the state of  /USER_STRUCT/allowed and i want to look for state of ‘this.checkbox.id.selected’ to set key as ‘X’ or ”.

                the key of checkbox used in the process ui action to fill a variable or do anything else (see  ui-action-key)

                i don’t want to create a boolean variable to save the checkbox selected, because i don’t need this value. i only need the key value X or not

                I don´t know how the syntax is in the Simplifier UI field?

                Attachments:
                You must be logged in to view attached files.
                Ralf Hader
                    3 years ago #25447
                    Up
                    0
                    Down
                    ::

                    Ich habe das ganze jetzt in einem Script gelöst, da ich es mit dem Binding im Moment nicht hinbekommen habe…

                    Das ganze sieht dann so aus:

                    if ((this.getItemValue('Meldung', 'CheckBox_User_allow', 'selected') == true)) { this.getGlobals().setVar('USER_STRUCT','j', 'allowed'); } else {this.getGlobals().setVar('USER_STRUCT','n', 'allowed');}

                    So kann ich das ganze mehrfach untereinander kopieren, die Felder der Checkbox (CheckBox_User_allow) und der Variable (USER_STRUCT.allowed) anpassen. Bei Button Press fülle ich die Struktur und schiebe sie ins PDF.

                    Vorteil ist dabei ist die freie Wahl was im String steht, da ich in der Struktur gleich String und keine Boolean mehr habe.

                    mfg Ralf

                  Viewing 5 posts - 1 through 5 (of 5 total)

                  You must be logged in to reply to this topic.