Skip to main content
November 12, 2021
Question

How to save values in different rows in tables?

  • November 12, 2021
  • 3 replies
  • 0 views

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
    November 12, 2021

    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
    November 12, 2021

    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.

    April 25, 2022

    Hi,

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