Skip to main content

Copy datasource value to another field in form

Comments

5 comments

  • Zendesk API User
    Author: bIT_sosswald - 7/26/2021 8:01

    Hi Sathya,

    take a look at: FirstSpirit Online Documentation - <ADD/> Calculating with dynamic forms

    In this example a date filed is taken, some days are added and the result is stored into another field. - I guess this could also work with the value of a combobox and a text field. When the combobox is filled by a datasource you must step in a little bit deeper to get the actual field of that datasource you want to use because the combobox itself stores the whole dataset.

    Greetings

    Sandro

    0
  • Zendesk API User
    Author: sathyapriyan - 7/27/2021 7:36

    Hi Sandro

    Thanks for answering the question. I tried several ways but nothing helped me. Or the other way, is it possible to store st_name.value.fieldname in st_name instead of datasource identifier?

    Seems <ADD> property is only helpful in case of integers and time units.

    Thank you,

    Sathya

    0
  • Zendesk API User
    Author: felix_reinhold - 7/27/2021 9:41

    Hi Sathya and Sandro,

    I don't think you can do this for a combobox with type database because you can't read properties/fields of the selected entity.
    In addition you can't use them in ValueServices. The question is what you want to achieve by passing the label to a textfield.

    Use another rule on it to verify the label is not empty or matches another condition?

    In my opinion in that case a FS_BUTTON would be your best option.

    Best regards

    Felix

    0
  • Zendesk API User
    Author: sathyapriyan - 7/29/2021 8:58

    Hi Felix,


    I want to feed the value from the data source to another utility with the label st_name. Currently,I get the unique ID out of it.

    Could you please help me how I can use FS Button to achieve it?

    Thank you,

    Sathya 

    0
  • Zendesk API User
    Author: felix_reinhold - 8/2/2021 9:16

    Hello Sathya,

    that's pretty simple. Just add a FS_BUTTON component and as parameters pass the two fields (the comboxbox and the textfield for the name). Sth. like that (please choose better name - just used them to make it easier to understand):

    <PARAMS>

    <PARAM name="comboboxField">#field.st_name</PARAM>

    <PARAM name="nameField">#field.st_namefield</PARAM>

    </PARAMS>

    Then createn Executable or for testing purposes a FirstSpirit Beanshell Script and assign it to the FS_BUTTON (FirstSpirit Online Documentation - FS_BUTTON )

    The parameters are ApiRemoteFormField Objects that provide the same methods as FormField FirstSpirit Access-API

    so the script would just have to get the value from st_combobox, get the name out of it and write it to st_namefield. Sth. like this (please add errorhandling and so on).

    nameField.set(comboField.get().getValue().getValue("fieldname"));

    Haven't tested the script.

    Best regards

    Felix

    0

Please sign in to leave a comment.