Skip to main content
Known Participant
Nov 12, 2021 11:03 AM UTC
Question

How to save values in different rows in tables?

Hi All,

I am stcuk with one of the implementation as described below:

I have a variable local!a which is having the values like 12;23;34 etc separated by semi-colon, when user click on save button the values 12, 23 and 34 should be saved into different rows in tables instead of single row.

Thank you

    3 replies

    venkatasaisatyanarayanaraot000
    Inspiring
    Nov 12, 2021 1:48 PM UTC

    a!localVariables(
      local!a: {12;23;34},
      local!saveData,
      {
        a!buttonLayout(
          primaryButtons: {
            a!buttonWidget(
              label: "save",
              saveInto: {
                a!save(
                  local!saveData,
                  a!forEach(
                    items: split(local!a,";"),
                    expression: {
                      id: fv!index,
                      output: fv!item
                    }
                  )
                )
              }
            )
          }
        )
      }
    )

    Hi  shubhamy0001,

    I have attached a sample code for the requirement , hope it can be helpful . I am constructing and saving the data in a localvaiable (local!saveData),  u can use a cdt in the expression of the foreach and save the value in the respective column. 

    And the in the button save u can have write to DB function (a!writeToDataStoreEntity())

    peter.lewis
    Employee
    Nov 12, 2021 2:58 PM UTC

    It think it would be helpful to attach some sample code for what you currently have. What data type is your original variable? What data type are you trying to save into? There's a lot of permutations so it would be helpful to understand your scenario better.

    Inspiring
    Apr 25, 2022 1:39 PM UTC

    Hi,

    Are you able to share your code, so that we can help you to fix this issue.