Data typing mapping issue with own data struct

  • Christian
        2 years ago #30109

        Hi all

        I have defined an own data type struct with two strings, a float and an integer. This data type is used as input parameter type for my server-side business object (SSBO). The values come from input fields in my UI: when I press the “save” button, I call my SSBO and in the input mapping, I connect the UI input widgets with the input parameters of the SSBO according to my data structure.

        The problem: if I do not provide a value in the float and integer input fields, I get an error in the console: “Uncaught Not an integer.” and “Uncaught Not a float”. If I provide a value, this error does not happen…

        What could I do here? Not providing any values in the input fields is fine from a business perspective.

        Thank you!

        Jennifer Häfner
            Has successfully completed the online course Intermediate (200)
            Has successfully completed the online course Advanced (300)
            Has successfully completed the online course Basics (100)
            Has successfully completed the online course Advanced (310)
            Has successfully completed the online course Advanced (320)
            Has successfully completed the Intermediate Certification
            Has successfully completed the Advanced Certification
          2 years ago #30127
          Up
          1
          Down
          ::

          Oh, I just realized that the error also occurs when the validation is off, because also here, Integer/Float expects a value that cannot be empty.

          So, you need to change the datatype in your BO from Integer/Float to String and add a validation before executing the BO (as described in 1b)) or work with default values for Integers/Floats (as described in 2)).

          Jennifer Häfner
              Has successfully completed the online course Intermediate (200)
              Has successfully completed the online course Advanced (300)
              Has successfully completed the online course Basics (100)
              Has successfully completed the online course Advanced (310)
              Has successfully completed the online course Advanced (320)
              Has successfully completed the Intermediate Certification
              Has successfully completed the Advanced Certification
            2 years ago #30125
            Up
            0
            Down
            ::

            Hi Christian,

            The validation mechanism for Integers/Floats expects some kind of value, so an empty value leads to an error in conversion.

            So, if your business process allows empty values here, you need to implement a validation mechanism yourself. There are several possibilities:

            1a) Deactivate the validation in the business object. In your BO code, you then need to validate the input values manually (e.g., using Javascript Regex)

            1b) You can also do the manual validation before even executing the business object: select your input field in the UI Designer and click on the small button next to the property ‘value’. Here, you can define when the input field is validated and what kind of datatype it should be (see attached image). In the datatype, you can define a Regular Expression and include that the value can be empty. Then, when the user inserts a value that does not match the datatype, the value state of the input field will change to ‘error’. Before executing the BO, you can check if any of the input fields have the value state ‘error’ (this can be done in the Process Designer using a UI action shape), and, if so, display an error message instead of triggering the BO.

            2) This only works depending on the business process: you could keep the validation in the BO active and set a zero as the default value in the input fields

             

            I hope this information can help you.

            Attachments:
            You must be logged in to view attached files.
          Viewing 3 posts - 1 through 3 (of 3 total)

          You must be logged in to reply to this topic.