Plus you may want to use the Update Table by Query widget. notice the vertical line vs horizontal line
@knash Ah, I’m so sorry! Thank you for being so incredibly patient with me. Our IT guy uses me for writing SSRS reports and BAQs, and he’s now slowly getting me into adding custom fields, user codes, and now BPMs. I’m loving what I’m learning, but it’s a lot of trial and error and “d’oh” moments! I also only just started a course on SQL, and seeing this C# coding is definitely muddying my brain, ha.
OrderNum is the relation between OrderHed/OrderDtl, and OrderNum and OrderLine are the relations between OrderDtl/OrderRel (and obviously Company is used for both relations as well).
that looks fine. try the update table widget.
As for you keys
Try this in the binding. These are expressions.
key3
System.Guid.NewGuid().ToString()
key4
BpmFunc.Now().ToString()
@knash I’m still trying your solution out, but just curious - why would I choose the Update Table (vertical) instead of the Fill Table (horizontal), when what I want to accomplish is adding new records to the table each time an order is changed?
@knash I added the two keys you were so kind to give me, and switched the Fill Table to an Update Table instead. Running into the exact same issue: upon saving the first change, it adds a new record to the table with all fields blank. Upon trying to save the second change, I run into the Duplicate Row Error.
I am dense. Could you send a screenshot of the error. with click on the details.
@knash Not a problem!
Screenshot showing that the first change was successfully added to the UD08 table, but all fields are empty (incorrect mapping?? not sure):
Screenshot of the error I run into when I try to save a second change on the same order:
ok so the record isn’t being created.
could you confirm that the rowmod is being set in the Update Table.
Duplicate record means that the passed combo Keys1-5 already exist. Maybe we need to use a DateTime stamp or new Guid as the key instead of the SysRow i mentioned earlier. If you are creating multiple UD records against the same source record, I would expect this error due to my suggestion of SysRow.
@Chris_Conn Ken caught that earlier and had me switch to SysRev, but now I’m using his two keys instead of SysRow/SysRev:
Key 1 = System.Guid.NewGuid().ToString()
Key 2 = BpmFunc.Now().ToString()
I might be missing something, but it seems like there are two separate issues at play. The first is that even when the BPM runs successfully, it’s writing completely empty fields into a new record.
The second is that it’s running into the Duplicate Row Error when trying to change an order a second time… but is this possibly because of the first issue, it’s writing completely empty rows, so when it tries to run again, the Key fields are empty and therefore a duplicate value?
looks like the new record isn’t being create based on your baq screenshot.
is that baq the whole table? I would have thought by now you would have 10000 rows. lol
@knash It’s creating one new record on the first change (before making the change it lists 0 rows, after making the change it lists 1 row).
It is the whole table, ha… I had my IT guy delete the empty record it created to try the new solutions you’ve given me starting with an empty table.
If you are using a new Guid and still getting that error methinks most likely the source logic triggering that is not only looking at new\updated records.
Many BPMs get 2 sets of data, changed and unchanged. If you are not differentiating, it could be trying to make 2 records per your data.
@Chris_Conn Sorry if this is elementary, but how (and where) would I tell it to only look at changed fields?
Assuming you are driving this from Order Lines, You should be able to filter the ttOrderDtl where RowMod equals “A” or “U”
“A” is added (new rows)
“U” is updated rows
“D” is deleted rows
“” is unchanged rows
@Chris_Conn Sorry for the delayed response! Currently, RowMod is set only to “A.” I tried to do “A” || “U”, and “A” | “U”, but neither expression worked. I’m new to C# and tried to find how to do it online - I see that those operators can’t be used for two strings, but I couldn’t find the solution anywhere.
try something like this in your condition:
ttOrderDtl.RowMod == “A” || ttOrderDtl.RowMod == “U”
Or another trick:
“A,U”.Contains(ttOrderDtl.RowMod)
@timshuwy Thank you! That gives me a CS1061 error:
‘OrderDtlTable’ does not contain a definition for ‘RowMod’ and no extension method ‘RowMod’ accepting a first argument of type ‘OrderDtlTable’ could be found (are you missing a using directive or an assembly reference?)
I know I’ve edited this setting before in a different BPM, but I don’t see anywhere in the widgets to edit using/assembly references.