Standard Directive - Table has multiple rows

Ok, here are my questions.

Is there anything in the first part (in trans) of your code, that is unique, but common to each record, that we could use as a “flag” or “identifier” of sorts, so we would know what to trigger off of in the standard
directive?

If so, I would first try to use the call context to store that information. But however you do it, if you
have something common to all records, but unique to the transaction, we can use that to pass to the standard.

If the answer is yes, I will suggest a way to pull that data in standard.

I think maybe the WarehouseGroupCode = “CAR” could be used.
Individual to each row would be the MtlQueueSeq field.

I only really need to focus on each individual record. and create an API post based on that 1 record.

I think I might have a more simple idea, but it only works if these come in batches.
Wouldn’t hurt to try it.

For the first record, the call context should be blank most likely.

Choose a field say, “Character01”

each time the in-trans fires, add a row, serialized to json, to Character01 and add a delimiter like a pipe.

callContextBpmData.Character01 += JsonConvert.SerializeObject(yourRow) + "|";

when the standard fires, first, check and pull off the last pipe “|”

if( callContextBpmData.Character01.EndsWith("|") ) 
{
    callContextBpmData.Character01 = callContextBpmData.Character01.Remove(callContextBpmData.Character01.Length - 1)
}

//or just 

callContextBpmData.Character01.TrimEnd("|");

Then split that string into json strings:

List<string> rowsList = callContextBpmData.Character01.Split("|").ToList();

Then, clear the callContextBpmData.Character01 field:
callContextBpmData.Character01 = ""

now you have the json for each row

you can deserialize that list back into actual rows, and get your data.

and this would give me 1 record each time inside the standard directive?

It would give you 1 batch of records, for each time the in trans fired.

Say in trans had 10 records, in standard, the call context field would have a list of the 10 records that fired.

You foreach on that rowsList, and do your process for each record.

something like

foreach(var rowStringJson in rowsList)
{
    MyTypeOfRow myrow = JsonConvert.DeserializeObject<MyTypeOfRow>(rowStringJson);

    DoSomeActionOn(myRow.whatever);

}

Hi, unsure on the adding a row on the first section. JsonConvert.SerializeObject(yourRow)
What should be going into yourRow?

I was going off the cuff and not looking at your code

“your row” is whatever row you need to store data from in the first part.

I would guess each MtlQueue row.

GENERIC :beers:

generic

2 questions.

Am I still to use the foreach on all code blocks in Standard Directive?

Also, I’m getting an error below.
image

try ‘|’

on the other question, gimme a sec

In the standard directive, I think the only foreach would be on your
rows list from the call context.

If you want to post the code instead of screenshots, I could edit it to make you a

“skeleton” to work off of and test.

I currently have this but it throws a few errors.
I will screenshot them seperately

if( callContextBpmData.Character01.EndsWith(“|”) )
{
callContextBpmData.Character01 = callContextBpmData.Character01.Remove(callContextBpmData.Character01.Length - 1);
}

List rowsList = callContextBpmData.Character01.Split(‘|’).ToList();

callContextBpmData.Character01 = “”;

foreach(var rowStringJson in rowsList)
{
MyTypeOfRow myrow = JsonConvert.DeserializeObject(rowStringJson);

DoSomeActionOn(myRow.whatever);

}

maybe i dont have all the correct references.

image

image

MyTypeOfRow was for you to fill in with the type of row you are storing/retrieving.

Sorry, you have lost me there.
Im not sure what is meant by type of row?

You’ll be storing a row from MtlQueue, it has a type, I don’t know what that is off the top of
my head, but we need to know so we can deserialize it properly.

Right, as in Anonymous, Dynamic and nullable types?
If thats the case im unsure what it is.

one sec