Skip to main content
Known Participant
January 21, 2021
Question

array of CDT as testcase expression

  • January 21, 2021
  • 3 replies
  • 0 views

Hello community members,

can you help me with the syntax for a array of CDT?

i tried:

'type!{urn:com:appian:types}EBLE_Test'(
{
item: 1,
checked: true,
item: 2,
checked: false
}

)

    3 replies

    erikb0001Author
    Known Participant
    January 21, 2021

    Got it working like this:

    {

    'type!{urn:com:appian:types}EBLE_Test'(
    item: 2,
    checked: true
    ),
    'type!{urn:com:appian:types}EBLE_Test'(
    item: 3,
    checked: true
    ),
    'type!{urn:com:appian:types}EBLE_Test'(
    item: 4,
    checked: false
    )
    }

    stewart.burchell
    Participating Frequently
    January 21, 2021

    If you wanted to save yourself the effort of hand-generating your test data you can use the a!forEach() loop, something like this:

    a!forEach(
    items: fn!enum(10)+1,
    expression: 'type!{urn:com:appian:types}EBLE_Test'(
    item: fv!item,
    checked: fn!even(fv!item) = fv!item
    )

    This will genertate an instance of the type for each item in the fn!enum() generated list,

    The 'item' attribute is set to the fv!item, and the 'checked' attribute is set to true if fv!item is even, else set to false.

    erikb0001Author
    Known Participant
    January 22, 2021

    Thanks Steward