Hello,
I have โOrderโ and โOrderDetailsโ tables, link with OrderID fields, and option โIs a part ofโ selected. โOrderDetailsโ has a field โSerialโ, which should not be duplicated. However, I found out that because of the โPart Ofโ option, when creating new records for โOrderDetailsโ, it will not be saved until the โOrderโ table is saved, and I donโt know how to prevent the duplication in this situation.
Can anybody help showing me what to do to achieve this?
Thanks.
Anh Han
Solved! Go to Solution.
Have your tried an expression something like below in the Vlaid_if of the [Product Serial Number] column in the Order Details table?
I tried it in the sample app with โIs Part of Settingโ between Orders and Order details and duplicates are prevented with the suggested expression.
Please refer the last section of the article below.
Hi,
This is not sequential number, this is product serial number, and it is unique by ProductID. What Iโm trying to achieve is to prevent user from wrongly enter serial number twice.
Thanks.
Anh Han
Maybe a valid_if false=In([_this], [virtual column in child table listing serials already added from parent row]) or just suggest the values in this column so you would know as youโre typing.
I believe a virtual column would allow you to skip waiting for table to be saved as they change as I enter data in a form, but Iโm not sure of this in this particular case.
Have your tried an expression something like below in the Vlaid_if of the [Product Serial Number] column in the Order Details table?
I tried it in the sample app with โIs Part of Settingโ between Orders and Order details and duplicates are prevented with the suggested expression.
Please refer the last section of the article below.
After reading this:
I figure your best bet is restructuring away from ispartof. You could probably have the deleting related records functionality when parent is deleted recreated with automation. Unless that feature is crucial Iโm not sure you would even need ispartof.
Iโd expect you can query the other IsAPartOf child rows being added:
ISNOTBLANK(
SELECT(
[Related OrderDetails][_ROWNUMBER],
AND(
([Serial] = [_THISROW].[Serial]),
([_ROWNUMBER} <> [_THISROW].[_ROWNUMBER])
)
)
)
I check the suggested expression, review my app and found out that โIsPartOfโ is not the problem, actually you can prevent duplication with ValidIf expression: NOT(IN([_THIS], SELECT(OrderDetails[Serial], [OrderDetailsID] <> [_ThisRow].[OrderDetailsID])))
Thank you all, I really appreciate your advice.
Anh Han
User | Count |
---|---|
43 | |
29 | |
29 | |
14 | |
14 |