How to make an Column in editable grid Dynamic?

We want to display dynamic column values  (e.g. if a field is a picklist, date, datetime, boolean, user picker, text, integer)

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    Hi, you can simply use the picker field date field anything you want.

    For more check the link https://docs.appian.com/suite/help/22.3/Editable_Grid_Component.html

    =a!localVariables(
      local!items: {
        {item: "Item 1", qty: 10, unitPrice: 10, date:now()},
        
      },
      a!gridLayout(
        label: "Products",
        instructions: "This is a grid layout with column weights: 5, 1, 1, 2",
        headerCells: {
          a!gridLayoutHeaderCell(label: "Item"),
          a!gridLayoutHeaderCell(label: "Qty"),
          a!gridLayoutHeaderCell(label: "Unit Price"),
          a!gridLayoutHeaderCell(label: "Date"),
          a!gridLayoutHeaderCell(label: "Total", align: "RIGHT")
        },
        columnConfigs: {
          a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
          a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
          a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
          a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
          a!gridLayoutColumnConfig(width: "DISTRIBUTE")
        },
        rows: a!forEach(
          items: local!items,
          expression: a!gridRowLayout(
            contents: {
              a!textField(
                value: fv!item.item,
                saveInto: fv!item.item
              ),
              a!integerField(
                value: fv!item.qty,
                saveInto: fv!item.qty
              ),
              a!floatingPointField(
                value: fv!item.unitPrice,
                saveInto: fv!item.unitPrice
              ),
              /*date time */
              a!dateTimeField(
                value: fv!item.date,
                saveInto:fv!item.date
              ),
              a!textField(
                value: dollar(tointeger(fv!item.qty) * todecimal(fv!item.unitPrice)),
                readOnly: true,
                align: "RIGHT"
              )
            }
          )  
        ),
        rowHeader: 1
      )
    )
    

  • 0
    Certified Senior Developer

    Could you please explain a bit more. if you want multiple columns then you gridrowlayout with multiple columns. If you want a single column but diff field type for different rows then based on some values you have to set the fields via if else condition.

  • 0
    Certified Associate Developer
    in reply to Deepak gupta

    can you share an example for the second point you mentioned on single column?

  • 0
    Certified Lead Developer

    You mean to show/hide column on different condition? If that is the question you can configure that using showWhen within the a!gridField() or a!gridLayout()