iterate on mobile with an only 1 item sized array

Home Forums Convertigo Products iterate on mobile with an only 1 item sized array

This topic contains 1 reply, has 2 voices, and was last updated by  Gregory Vorbe 3 weeks, 3 days ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #255647

    Alexandre Perret
    Participant

    Hi

    I’ve got a sequence that returns an array of item as XML. The sequence retrieve datas from a SQL transaction.
    I call this sequence from mobile builder, and iterate over the items returned by the sequence.

    Everything is going fine until my datas returned by the transaction is of a size of only 1 item. In this case I got a client error :
    Error: Error trying to diff '[object Object]'. Only arrays and iterables are allowed

    How could I make this working for any size my array is ?
    (I’m running c8o 7.5.4)

    #255648

    Gregory Vorbe
    Moderator

    Hi Alexandre,

    In your sequence, you have to encapsulate the steps where you generate items from the SQL transaction call, in a complex step.
    Then, add in it an “Attribute” step set to “type” for “Node name” property and “array” for “Default value”.
    This will force the JSON response as an array even with only 1 item.

    For example:

    MySequence
    |_ Call_SQL_Transaction_Step
    |_ My_Complex_Step
    |_ Attribute step (@type=array)
    |_ CopyOf (Call_SQL_Transaction_Step)

    QA&Support

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.