Skip to main content
hema.mathivathanan
March 7, 2024
Solved

tag field with a separator

  • March 7, 2024
  • 7 replies
  • 0 views

Hi All,

I have got a small question while using a!tagField. I wanted to add 2 tag items separator with a "/".When I use like below, I am getting an error. I tried using concat, & but both didn't work,

Can someone help here.

a!tagField(
labelPosition: "COLLAPSED",
tags: {
concat(
a!tagItem(
text: "t1",
backgroundColor: "#aaa9ad",
textColor: "#ffffff"
),
& "/"&
a!tagItem(
text: "t2",
backgroundColor: "#990099"
)
)
},
size: "STANDARD"
)

    Best answer by davidj137213

    Why don't you use another tag item , rather that concatenate?

    a!tagField(
    labelPosition: "COLLAPSED",
    tags: {
    /*concat(*/
    a!tagItem(
    text: "t1",
    backgroundColor: "#aaa9ad",
    textColor: "#ffffff"
    ),
    a!tagItem(
    text: "/",
    backgroundColor: "#FFFFFF"
    ),

    a!tagItem(
    text: "t2",
    backgroundColor: "#990099"
    )
    /*)*/
    },
    size: "STANDARD"
    )

    7 replies

    konduruc733182
    March 7, 2024

    Hello [mention:3670269dff3147e3822f8c49c86782af:e9ed411860ed4f2ba0265705b8793d05] 

    Are these tags coming from any set of data? if yes, it cannnot be done using multiple tags. FYI you cannot use concat or '&' in the tag fields.

    hema.mathivathanan
    March 7, 2024

    yeah, I am using the data from the record

    konduruc733182
    March 7, 2024

    a!localVariables(
      local!map: {
        a!map(
          text: "T1",
          backgroundColor: "#aaa9ad",
          textColor: "#ffffff"
        ),
        a!map(
          text: "T2",
          backgroundColor: "#990099",
          textColor: "#ffffff"
        )
      },
      a!columnsLayout(
        columns: {
          a!columnLayout(
            width: "NARROW",
            contents: a!sideBySideLayout(
              spacing: "NONE",
              items: {
                a!forEach(
                  items: local!map,
                  expression: {
                    a!sideBySideItem(
                      item: a!tagField(
                        labelPosition: "COLLAPSED",
                        tags: {
                          a!tagItem(
                            text: fv!item.text,
                            backgroundColor: fv!item.backgroundColor,
                            textColor: fv!item.textColor
                          )
                        },
                        size: "STANDARD"
                      )
                    ),
                    a!sideBySideItem(
                      item: a!richTextDisplayField(
                        value: a!richTextItem(text: "/")
                      ),
                      showWhen: not(fv!isLast)
                    )
                  }
                )
              }
            )
          )
        }
      )
    )

    this is the best that I was able to get. Not sure of any other possible way.

    davidj137213
    Brainy
    March 7, 2024

    Why don't you use another tag item , rather that concatenate?

    a!tagField(
    labelPosition: "COLLAPSED",
    tags: {
    /*concat(*/
    a!tagItem(
    text: "t1",
    backgroundColor: "#aaa9ad",
    textColor: "#ffffff"
    ),
    a!tagItem(
    text: "/",
    backgroundColor: "#FFFFFF"
    ),

    a!tagItem(
    text: "t2",
    backgroundColor: "#990099"
    )
    /*)*/
    },
    size: "STANDARD"
    )

    hema.mathivathanan
    March 7, 2024

    Thanks David, I tried this but missed the background color to keep as white