Hello everyone,
One of our customers has got a job which changes InventTransIds in the table InventTrans by adding one-char suffix to some of them. I see that this fiel is used in multiple classes in the system and is compared with the invetntransid form other tables. So as I see such a changing can cause multiple long-term consequences.
OK. Let's not take this into account yet. After such changing customer referred to me with the problems on the form. InventTrans. For the records of InventTrans where the InventTransId field has been changed it doesn't show the info from the 3 datasources - InventTransPostingPhysical, InventTransPostingFinancial and InventTransPostingPhysicalRevenue. All these 3 datasources are bound to the same table - InventTransPosting. InventTtans table and InventTransPosting table are related using relations on the InventTtans:
Also InventTRansID, Voucher, TransDate, InventTransPostingType fields together are a unique index for the table InventTransPosting:
Then I checked out what code is in init method of all three datasources. It is as following:
void init()
{
Query query = new Query();
;
query.addDataSource(tablenum(InventTransPosting));
query.dataSourceNo(1).addDynalink(fieldnum(InventTransPosting, Voucher),
inventTrans,
fieldnum(InventTrans,VoucherPhysical));
query.dataSourceNo(1).addDynalink(fieldnum(InventTransPosting, TransDate),
inventTrans,
fieldnum(InventTrans,DatePhysical));
query.dataSourceNo(1).addDynalink(fieldnum(InventTransPosting, InventTransId),
inventTrans,
fieldnum(InventTrans,InventTransId));
query.dataSourceNo(1).addRange(fieldnum(InventTransPosting,InventTransPostingType)).value(queryValue(InventTransPostingType::PhysicalRevenue));
inventTransPostingPhysicalRevenue_DS.query(query);
super();
}
Because the InventTransID has been changed in InventTrans but it is the same as it was in InventTransPosting it can't find the related records in InventTransPosting and therefore we don't see any info in the form.
I see 2 solutions here:
1) Change InventTransPosting.InventTRansId to the same value as it is in InventTRans during the job implementation
But since the field InventTransPosting.InventTRansId is used in many othe places it can break other logic
2) Somehow change the code on the form so it will search InventTRansId by mask
Can you pls point me to the right direction?
Thanks.