How Do I Remove A Blank Record From a CDT in the process model?

Hello,

In my process model I have a CDT that I use to pass in to a form.  In the process model is there a way to remove a blank record.

In my CDT the very first record is always empty, so when I pass the CDT to the form my editable grid on the first row is empty with no data.

I am trying to figure out how I can delete the first record from the CDT before passing it to the form in the process model.

The CDT is multi and can hold more than 1 record as well.

Thank you for any help

  Discussion posts and replies are publicly visible

Parents
  • If you are always removing the first row in the CDT, in a Script Task you can use the remove() function over the CDT in an output expression, save it back to the same CDT and you will be left with all rows other than the first:

    a!localVariables(
      local!cdt: {
        'type!{urn:com:gdit:types}COE_Sample_CDT'(),
        'type!{urn:com:gdit:types}COE_Sample_CDT'(id: 1)
      },
      
      remove(local!cdt,1)
    )

    If you can have null values throughout the CDT, you can clear them with an expression such as:

    a!localVariables(
      local!cdt: {
        'type!{urn:com:gdit:types}COE_Sample_CDT'(),
        'type!{urn:com:gdit:types}COE_Sample_CDT'(id: 1),
        'type!{urn:com:gdit:types}COE_Sample_CDT'()
      },
      
      a!flatten(
        fn!reject(
          fn!isnull,
          a!forEach(
            items: local!cdt,
            expression: if(
              rule!APN_isBlank(fv!item.id),
              null,
              fv!item
            )
          )
        )
      )
    )

Reply
  • If you are always removing the first row in the CDT, in a Script Task you can use the remove() function over the CDT in an output expression, save it back to the same CDT and you will be left with all rows other than the first:

    a!localVariables(
      local!cdt: {
        'type!{urn:com:gdit:types}COE_Sample_CDT'(),
        'type!{urn:com:gdit:types}COE_Sample_CDT'(id: 1)
      },
      
      remove(local!cdt,1)
    )

    If you can have null values throughout the CDT, you can clear them with an expression such as:

    a!localVariables(
      local!cdt: {
        'type!{urn:com:gdit:types}COE_Sample_CDT'(),
        'type!{urn:com:gdit:types}COE_Sample_CDT'(id: 1),
        'type!{urn:com:gdit:types}COE_Sample_CDT'()
      },
      
      a!flatten(
        fn!reject(
          fn!isnull,
          a!forEach(
            items: local!cdt,
            expression: if(
              rule!APN_isBlank(fv!item.id),
              null,
              fv!item
            )
          )
        )
      )
    )

Children