Standard Directive - Table has multiple rows

I have a Standard Directive on the MtlQueue table which should send an API request per individual line in the Material Queue. I need the Post call to the API to happen after the new record has written to the table so I have to use Standard Directive.

I cannot get around the ‘ttMtlQueue has mulitple records’ error message.

The Directive is as below.

image

image

This works perfectly fine in In Transaction but it posts to the API too soon as we have records sat in waiting and then a program will remove the records from the material queue.

I am unsure how to get around the multiple row issue!

In your SetMtlSeq Var 1, you are trying to set it to the value of 1 row, when there are more than
one. You either need to process for all rows, or pick a row to get your value from.

@klincecum I would need to process for all rows… not too sure how i would go about that?

I think I was reading/looking at it wrong the first time.

Have you tried moving this from a data directive, to a post-processing method directive?

I have tried running this through MaterialQueue.Update Post Processing but it doesnt run.

What does that mean ?

Have you done a trace and seen exactly what is called normally?

It may not be Update.

I ran a trace but it returns no Methods.
I am trying to hook onto a process that was created by a third party consultant.
the In Transaction directive on the MtlQueue table is the only directive that seems triggers anything.

I have resorted to using the below to figure out which methods or tables i can use in Post but nothing happens.

image

Just to add, with the standard process i can trigger andy bpm to run :frowning:

How is this method kicked off in the first place?

Its a scheduled function to create material queue records.

Can we see that part, or could you describe it?

The only reference on the function is this dll file.
image

I cant get into it, it seems to be locked.

We run it on a schedule and it picks up any sales orders that can be picked in the warehouse and sends them out to the material queue for picking. It auto allocates to available warehouse bins, skipping the Fulfilment Workbench.

Ok, let me think on it. Or maybe someone else will understand the data directive problem better.

Start here:

Pay particular attention to the posts by @Rich

But the rest are essential as well.

The gist I got from it is do your work in the in trans data directive,
and pass it to the standard through the call context data or some other means
and do your final work/post there.

@klincecum I have managed to get the Standard Directive firing and bringing over the MtlQueueSeq field from in transaction. which is a great start so thank you for pointing me in that direction.

First issue. if i update 4 records i only get the latest record not the preceding 3.

Second issue, The post to the API fails but i imagine it is to do with the below error from Event Viewer.

That is correct.

You will need to somehow store the data you need for processing, and do your processing
off of that.

You only get the last record written.

by storing do you mean use the BPM Data fields in in-transaction to store data i want to use in Standard Directive?

Yes, at least that’s what I would try first.

Your in-trans will fire for each record.

I would use a Character field and add data with a delimiter, or json object, on each iteration, and
pick it up in the standard.

I have made some progress.

I can create .txt files for each record updated which contains the correct data from within Standard Directives using.

image

I cant however trigger the API post code block after this using the code.

If you’re going to go down this road, I would suggest a slightly different approach.

I would choose a UD table, or the systag table, and add a record or a tag for each updated
record.

Then you could query in the standard directive for that data, act upon it, and then delete or mark
the temporary rows inactive.


I’m unsure exactly what you mean about not being able to trigger what you need next.

I’m going to ask some questions in the next post to keep it separate.