Hello,
I have created a new field in between Number and reference type in the below screenshot and I am trying to display the topLevel reference itemId.
In order to achieve it, I am trying to get the top level refId. Please see the below screenshot for better understanding.
I tried with the following steps,
Created a new field in the table ReqTrans -> Created a display method with the following code to get the ToplevelRefID
public static display PoolId displayPool(ReqTrans _this) { PoolId poolId; ReqPO reqPO; switch (_this.RefType) { case ReqRefType::BOMLine : case ReqRefType::BOMPlannedOrder : poolId = ReqPO::find(_this.PlanVersion,_this.RefId).ItemId; break; default: } return poolId; }
I have used switch case cos I have other scenarios also dont mind that.
Please help me to achieve this.
Thanks
Hello Kranthi,
Thaks for your reply. I modified the code as you said but I am getting the same,
public static display PoolId displayPool(ReqTrans _this) { PoolId poolId; ReqPO reqPO; switch (_this.RefType) { case ReqRefType::BOMLine : case ReqRefType::BOMPlannedOrder : //poolId = ReqPO::find(_this.PlanVersion,ProdTable::findTopLevelRef_this.RefId).ProdId).ItemId; poolId = ReqPO::find(_this.PlanVersion,ReqTrans::findRecId(_this.selectCov().IssueRecId).RefId).ItemId; break; default: } return poolId;
I am not getting the topmost level . Instead of getting the top reference. Please see the following image for your better understanding,
In the above image on choosing the cube Timer, I am getting 0750 instead I should get 10101.
You are modifying the ReqTransExplosion form right? if you simply want to display in the grid what ever is displayed on the top section, then you can do a simple trick Declare a global variable in class declaration of the form and write a display on form methods to return that variable. In the execute Query method of the data source assign a value to that variable. Example: InventTransRefId refid; // this is in class declaration In the ReqTransCaller.executeQuery() method do the assignment, refid = reqTransFind.RefId; Write a display method to return this variable (refid) use that method for the newly added control.