Issue using icons on grid with validation.

Hi, I want to create a tempo Reports for the first time and I want to use an icon to showed on the grid column with validation.
If the result of the validation is yes for Product A, so it will show an Icon A on the grid column, and if the result of the validation is no for product A, it will show an icon B on the grid column.
Here, I attach a file that was my script, may someone could help me to correct my script if I have some wrong script on it, because my script can't work as well.

Thank you very much for helping :)
-----------------------------------------------------------------
load(
local!pagingInfo: a!pagingInfo(
startIndex: 1,
batchSize: 10,
sort: {
field: "dateTimeSubmit",
ascending: false
}
),
with(
local!datasubset: rule!Get_ProjectReport(
local!pagingInfo
),
if(
local!datasubset.totalCount < 1,
rule!APN_uiTextReadOnly(
label: "There are no Project Report"
),
...

OriginalPostID-111898

OriginalPostID-111898

  Discussion posts and replies are publicly visible

  • ... a!gridField(
    totalCount: local!datasubset.totalCount,
    columns: {
    'type!{www.appian.com/.../2009}GridTextColumn'(
    label: "Employee Name",
    data: local!datasubset.data.nameSubmit,
    field : "nameSubmit"
    ),
                         a!gridImageColumn (
                                  label: "Product",
                                  field: "product",
                                  data: {
                                  if(local!datasubset.data.product="A",
                                            a!webImage(
                                                      source: cons!Icon_A,
                                                      size: "ICON"
                                            ),
                                            a!webImage(
                                                      source:cons!Icon_Approve,
                                                      size: "ICON"
                                            )),
                                  if(local!datasubset.data.product="B",
                                            a!webImage(
                                                      source: cons!Icon_B,
                                                      size: "ICON"
                                            ),
                                            a!webImage(
                                                      source:cons!Icon_Approve,
                                                      size: "ICON"
                                            )),
                                  
                                  }
                         ),
    /*'type!{www.appian.com/.../2009}GridTextColumn'(
    label: "Product",
    data: local!datasubset.data.product
    ),*/
    'type!{www.appian.com/.../2009}GridTextColumn'(...
  • ...
    label: "Date From",
    data: local!datasubset.data.dateFrom,
    field : "dateFrom"
    ),
    'type!{www.appian.com/.../2009}GridTextColumn'(
    label: "Date To",
    data: local!datasubset.data.dateTo,
    field : "dateTo"
    ),
    'type!{www.appian.com/.../2009}GridTextColumn'(
    label: "Customer",
    data: local!datasubset.data.customer,
    field : "customer"
    ),
    'type!{www.appian.com/.../2009}GridTextColumn'(
    label: "Step Progress",
    data: local!datasubset.data.stepProgress
    ),
    'type!{www.appian.com/.../2009}GridTextColumn'(
    label: "Project Note",
    data: local!datasubset.data.projectNote
    )
    },
    value: local!pagingInfo,
    saveInto: local!pagingInfo
    )
    )
    )
    )
  • Hi, here's a sample code
    ---------------------------------
    1. Create first expression rule with a rule input - product
    2. Enter the code something like below and save

    if(ri!product="A",
                        a!documentImage(document: cons!Icon_A)
              ,
                        if(ri!product="B",
                                  a!documentImage(document: cons!Icon_B)
                        ,
                                  null
                        )
    )
    save the expression rule with filename like - displayProductIcon (this will be called/used in the form as rule!displayProductIcon)
    3. Once the expression rule is created, go to the form and enter the following code
    a!gridImageColumn(
    label: "Product",
    field: "product",
    size: "ICON",
    data:
    apply(rule!displayProductIcon,index(local!datasubset.data,"product",{}))

    )

    The apply loop will call the displayProductIcon expression/function and will loop on each product in the product datasubset.