Dynamic type values

Is there a way to create a type that has dynamic columns using flowscript?

I have a Quick Report in IFS cloud that allows for column name edits. I need to pull the data from this QR and display the results to in a user step via a data grid. Due to that, I need to create the type structure with the appropriate column names.

ex type. Columns could edited, added, and removed.

Hi,

You can define multiple response types and check if the result is type1 or type2 or …

In an example it looks this:

type SuccessResponseType_1 = { value: {C1_SCENARIO: text?, etc. }* };
type SuccessResponseType_2 = { value: {C1_PART_NO: text?, etc. }* };
type SuccessResponseType_3 = { value: {C1_LOT_NO: text?, etc. }* };

//output type of the script step
//type outputType = {scenario: text, part_no: text, lot_no: text} 

let request = HTTP.getText(…);

let responseResult =  JSON.deserialize(request.contents);

if responseResult is SuccessResponseType_1 
{
    return (select C1_SCENARIO as  scenario,
                   "" as  part_no,
                   "" as  lot_no
              from responseResult.value);
}
elseif responseResult is SuccessResponseType_2 
{
    return (select "" as  scenario,
                   C1_PART_NO as  part_no,
                   "" as  lot_no
              from responseResult.value);
}
elseif responseResult is SuccessResponseType_3 
{ 
    return (select "" as  scenario,
                   "" as  part_no,
                   C1_LOT_NO as  lot_no
              from responseResult.value);
}
else
{
    error "Unknow response format";
}

I hope this is helpful.

Best,
Zoltan