pickerFieldCustom to not select a value.

Certified Associate Developer

I have a custom picker field which is used to select the countries. From the list of all countries the user should not be able to select and save Great Britain and Northern Ireland. Can someone please suggest how I can achieve this.

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Associate Developer
    in reply to Konduru Chaitanya

       

    Suggest function code:

    /* Rule returns a data subset with data as Country name   identifier as ISO  code and with 20 entries at a time*/
    a!localVariables(
      local!saveCountryOrIsoCode: rule!APN_replaceNull(
        nullableValue: ri!saveCountryNameOrIsoCode,
        replacementValue: false
      ),
      local!isClusterIncluded: toboolean(
        rule!APN_replaceNull(
          nullableValue: ri!isClusterIncluded,
          replacementValue: false
        )
      ),
      local!pagingInfo: rule!APN_replaceNull(
        nullableValue: ri!pagingInfo,
        replacementValue: a!pagingInfo(
          startIndex: 1,
          batchSize: 20,
          sort: a!sortInfo(field: "country_txt", ascending: true)
        )
      ),
      local!paginfoCluster: rule!APN_replaceNull(
        nullableValue: ri!clusterPagingInfo,
        replacementValue: a!pagingInfo(
          startIndex: 1,
          batchSize: 20,
          sort: a!sortInfo(field: "clusterName_txt", ascending: true)
        )
      ),
      local!data: if(
        rule!APN_isEmpty(ri!filter),
        null,
        a!queryEntity(
          entity: cons!RGRACSLBL_ENTITY_COUNTRY_REGION,
          query: a!query(
            selection: a!querySelection(
              columns: {
                a!queryColumn(field: "isoCode_txt", visible: true()),
                a!queryColumn(field: "country_txt", visible: true())
              }
            ),
            logicalExpression: a!queryLogicalExpression(
              operator: "AND",
              filters: {
                a!queryFilter(
                  field: "region_txt",
                  operator: ">",
                  value: " "
                ),
                a!queryFilter(
                  field: "country_txt",
                  operator: "includes",
                  value: ri!filter
                )
              }
            ),
            pagingInfo: local!pagingInfo
          )
        )
      ),
      local!data2: if(
        and(
          not(rule!APN_isEmpty(ri!filter)),
          local!isClusterIncluded
        ),
        a!queryEntity(
          entity: cons!RGRACSLBL_ENTITY_LABEL_LU_REF_CLUSTER,
          query: a!query(
            selection: a!querySelection(
              columns: {
                a!queryColumn(field: "clusterName_txt", visible: true())
              }
            ),
            logicalExpression: a!queryLogicalExpression(
              operator: "AND",
              filters: {
                a!queryFilter(
                  field: "clusterName_txt",
                  operator: "in",
                  value: cons!RGRACSLBL_TEXT_CLUSTERS_REFERENCE_COUNTRY
                ),
                a!queryFilter(
                  field: "clusterName_txt",
                  operator: "includes",
                  value: ri!filter
                )
              }
            ),
            pagingInfo: local!paginfoCluster
          )
        ),
        null
      ),
      if(
        local!isClusterIncluded,
        if(
          and(
            rule!APN_isEmpty(index(local!data, "data", null)),
            rule!APN_isEmpty(index(local!data2, "data", null))
          ),
          a!dataSubset(data: null, identifiers: null),
          a!dataSubset(
            data: reject(
              fn!isnull,
              append(
                index(
                  index(local!data, "data", null),
                  "country_txt",
                  null
                ),
                index(
                  index(local!data2, "data", null),
                  "clusterName_txt",
                  null
                )
              )
            ),
            identifiers: reject(
              fn!isnull,
              append(
                index(
                  index(local!data, "data", null),
                  if(local!saveCountryOrIsoCode,  "country_txt", "isoCode_txt"),
                  null
                ),
                index(
                  index(local!data2, "data", null),
                  "clusterName_txt",
                  null
                )
              )
            )
          )
        ),
        rule!APN_isEmpty(index(local!data, "data", null)),
        a!dataSubset(data: null, identifiers: null),
        a!dataSubset(
          data: index(
            index(local!data, "data", null),
            "country_txt",
            null
          ),
          identifiers: index(
            index(local!data, "data", null),
            if(local!saveCountryOrIsoCode,  "country_txt", "isoCode_txt"), 
            null
          )
        )
      )
    )

  • +1
    Certified Senior Developer
    in reply to p2005

    In your query could you simply add a queryFilter with "not in" operator and exclude the two values?