How to set a default value to column in editable grid, by using addRowLink which is using empty instance of CDT type as its value?

Hi,

Am trying to set default value to a column in editable grid, am using "addRowLink" to add a new row in editable grid by click of the link I need to a default value to column in the grid (Created_By - which is hidden). In the value: attribute of 'addRowLink' am using a blank instance of CDT type, so in this case how can i set default value to a field (Created_By) in the referenced CDT for each added row in Editable grid.

load(
  local!questionsDataset: a!queryEntity(
    entity: cons!TEST_QUESTIONS_MAPPING,
    query: a!query(
      selection: a!querySelection(
        columns: {
          a!queryColumn(
            field: "Id"
          ),
          a!queryColumn(
            field: "DC_Question_Group"
          ),
          a!queryColumn(
            field: "TEST_Question_Group"
          ),
          a!queryColumn(
            field: "Created_By"
          ),
          a!queryColumn(
            field: "Created_On"
          )
        }
      ),
      pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: 20,
        sort: a!sortInfo(
          field: "Created_On",
          ascending: true
        )
      )
    )
  ),
  with(
    a!formLayout(
      label: "Duckcreek - TEST Question Mapping",
      instructions: "This interface is to map the DC & TEST Questions",
      contents: {
        a!gridLayout(
          totalCount: count(
            local!questionsDataset.data
          ),
          headerCells: {
            a!gridLayoutHeaderCell(
              label: "Id"
            ),
            a!gridLayoutHeaderCell(
              label: "DC Qn Group"
            ),
            a!gridLayoutHeaderCell(
              label: "TEST Qn Group"
            ),
            /* For the "Remove" column */
            a!gridLayoutHeaderCell(
              label: ""
            )
          },
          columnConfigs: {
            a!gridLayoutColumnConfig(
              width: "DISTRIBUTE",
              weight: 0.5
            ),
            a!gridLayoutColumnConfig(
              width: "DISTRIBUTE",
              weight: 5
            ),
            a!gridLayoutColumnConfig(
              width: "DISTRIBUTE",
              weight: 5
            ),
            a!gridLayoutColumnConfig(
              width: "DISTRIBUTE",
              weight: 1
            )
          },
          rows: a!forEach(
            items: local!questionsDataset.data,
            expression: a!gridRowLayout(
              contents: {
                a!integerField(
                  label: "Id " & fv!index,
                  value: fv!item.Id,
                  saveInto: fv!item.Id,
                  readOnly: true()
                ),
                a!textField(
                  label: "DC Qn Group " & fv!index,
                  value: fv!item.DC_Question_Group,
                  saveInto: fv!item.DC_Question_Group,
                  required: true
                ),
                a!textField(
                  label: "TEST Qn Group " & fv!index,
                  value: fv!item.TEST_Question_Group,
                  saveInto: fv!item.TEST_Question_Group,
                  required: true
                ),
                a!textField(
                  label: "Created By " & fv!index,
                  value: fv!item.Created_By,
                  saveInto: fv!item.Created_By,
                  showWhen: false()
                ),
                a!imageField(
                  label: "delete " & fv!index,
                  images: a!documentImage(
                    document: a!iconIndicator(
                      "REMOVE"
                    ),
                    altText: "Remove Employee",
                    caption: "Remove " & fv!item.Id,
                    link: a!dynamicLink(
                      value: fv!index,
                      saveInto: {
                        a!save(
                          ri!questionsToUpdate,
                          remove(
                            ri!questionsToUpdate,
                            save!value
                          )
                        )
                      }
                    )
                  ),
                  size: "ICON"
                )
              },
              id: fv!index
            )
          ),
          addRowlink: a!dynamicLink(
            label: "Add Group",
            value: 'type!{urn:wipro:TEST:appian:TESTintegration}TEST_Questions_Mapping'(),
            saveInto: {
              a!save(
                local!questionsDataset.data,
                append(
                  local!questionsDataset.data,
                  save!value
                )
              )
            }
          )
        ),
        a!buttonLayout(
          primaryButtons: {
            a!buttonWidgetSubmit(
              label: "Submit",
              style: "PRIMARY",
              saveInto: {
                a!save(
                  ri!questionsToUpdate,
                  local!questionsDataset.data
                )
              }
            )
          },
          secondaryButtons: {
            a!buttonWidgetSubmit(
              label: "Cancel",
              style: "NORMAL",
              value: true,
              saveInto: ri!cancel,
              skipValidation: true
            )
          }
        )
      }
    )
  )
)

 

Regards,

Balaji.R

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data