Hi Experts,
Can any one explain the following code. How it is working.what is the use of the Find Mehtod.
static InventTable find(ItemId itemId,
boolean update = false)
{
InventTable inventTable;
;
inventTable.selectForUpdate(update);
if (itemId)
{
select firstonly inventTable
index hint ItemIdx
where inventTable.ItemId == itemId;
}
return inventTable;
}
Thanks in Advance…
This method is used to get all the details about product based on ItemId. And this method require 2 arguments
It is not a Override method. So they gave the name find for better understand.
Hi Roshan,
Thanks for your Quick Reply.
I want to know these cases 1) if i put boolean update = false what will happen.why it is default false.
- if i put boolean update = true what will happen.
Explain below statement
inventTable.selectForUpdate(update); ==> what is the use of this line of code.how it works
The second parameter is just a way to have the Find method more complete, so you should set it to True when you want to modify the found buffer, for example:
inventTable = InventTable::find(“Frame”, true);
inventTable.PBAItemConfigurable = NoYes::No;
inventTable.update();
This is the same as:
inventTable = InventTable::find(“Frame”);
inventTable.selectForUpdate(true);
inventTable.PBAItemConfigurable = NoYes::Yes;
inventTable.update();
So basically is a best practice in order to have better code.
Hi,
If i put boolean update = false ,If condition satisfy , It will not return any value at first looping its true or false(actually there is no default property value for variable),If you put boolean update=true ,It will return the value ,If condition is satisfy.If condition fail,it will exit .
inventTable.selectForUpdate(update); ==>("Use of update the variable values,whether delete,insert,modify…whatever Updates)