I’ve a Block TG that inserts a block and another that I want to use to update the block periodically afterwards.
How do I get the Block ID from the first insertion?
I want to use it in a custom ‘where’ clause in the block update TG.
Do I need to have a separate query for this?
Yeah, unfortunately your only real option is probably to use an expression item in the second block that runs a “select max(blockid) from table”. I say “unfortunately” because this doesn’t work well if you’ve got multiple sets of groups trying to use the same table. If it’s just one pair, though, it should be fine.
I’m storing multiple sets for a lot of equipment.
I’ve included a unique BatchID in each block and use this in an expression to return the BlockID.
I’m using a memory tag to handshake between 2 groups.
The Insert group sets the tag to 1 when complete.
This triggers the Update group which resets the tag to 0 when complete.
Is there any issue using a memory tag like this? (scan class etc.)
I noticed, on one occasion, that the tag didn’t reset to 0.
It may have been because I was making a modification around the same time, but I’m just curious about using a memory tag in this manner.
No, there shouldn’t be any big problems, the scan class won’t come into play much, as the values get set right away on memory tags.
Are the groups set to only execute once on trigger? Otherwise, I don’t quite know why the tag wouldn’t get reset… try watching it a bit, and if you can figure out a sequence leading to this, we can take a look.
This hasn’t happened since.
I put the group on a continuous trigger overnight (off a PLC timer) and trend the reset flag.
I’m putting it down to operator (me) error.