Hello Everyone,
I need some help to create a form using fields from InventTable and InventTableModule. The two fields the form will use are ItemID and SalesPrice.
This is the job to get the sales price base on the itemid passed.
static void AXListPrices(Args _args)
{
InventTable it;
InventTableModule itm;
;
while select it where it.ItemId=="100001"
join itm where it.itemid == itm.ItemId
&& itm.ModuleType == ModuleInventPurchSales::Sales
{
info(strFmt("%1", itm.Price));
}
}
All I need to go is the following......
Create a form that allow the user to choose a item number and then the corresponding sale price will be displayed.
Please my friends that all i want o do any help, suggestions or example would be greatly appreciated.
*This post is locked for comments
Thanks a million Rustem, I have been working on this over a week now. Thanks much again am good to go now. Really appreciate your help.
You don't need to create a table.
Just create a form with two fields:
1. Item number - create string field and set EDT ItemId
2. Item sales price - create real field and set EDT SalesPrice, AutoDeclaration = YES, AllowEdit = No
3. On Item number field override modified() method and write this code:
public boolean modified() { boolean ret; ret = super(); ItemSalesPrice.realValue(InventTableModule::find(this.valueStr(), ModuleInventPurchSales::Sales).Price); return ret; }
I am trying my best to follow the recommendations because am not clear as to what i must do.
this is what i have done:
1. Created a new table with two fields image newtable
with this table i used the EDT on ItemID to get the lookup from InventTable (see relation)
2. I created a form and use table (newtable) as its datasource see image newtableform
3. Under the ItemID field I override the modified method by adding this code:
using the following code:
public void modified()
{
InventTable it;
InventTableModule itm;
ItemPrice itemp;
;
if(itemp.ItemIDCost)
{
while select itemp where itemp.ItemIDCost==it.ItemId
join itm where it.itemid == itm.ItemId
&& itm.ModuleType == ModuleInventPurchSales::Sales
{
itemp.ItemPriceShow = strFmt("",itm.Price);
}
}
}
After doing this nothing happens. The Price is not displaying in the in the other field. Can you please help me? i have a deadline and need to complete this. Please your help on it.
my form
please help
thanks for responding Rustem,
I am trying my best to follow your recommendation because am not clear as to what i must do.
this is what i have done:
1. Created a new table with two fields image newtable
with this table i used the EDT on ItemID to get the lookup from InventTable (see relation)
2. I created a form and use table (newtable) as its datasource see image newtableform
3. Under the ItemID field I override the modified method by adding this code:
using the following code:
public void modified()
{
InventTable it;
InventTableModule itm;
ItemPrice itemp;
;
if(itemp.ItemIDCost)
{
while select itemp where itemp.ItemIDCost==it.ItemId
join itm where it.itemid == itm.ItemId
&& itm.ModuleType == ModuleInventPurchSales::Sales
{
itemp.ItemPriceShow = strFmt("",itm.Price);
}
}
}
After doing this nothing happens. The Price is not displaying in the in the other field. Can you please help me? i have a deadline and need to complete this. Please your help on it.
my form
You can use the Item Id value from the form as follow, then you can use the value in where condition to select sales price.
_itemId =ItemId.valueStr(); // ItemId is stringEdit which you are going to make for Item Id and should change the property "AutoDeclaration" to Yes.
Hi Lionel07!
You want to create a form with only two fields?
So, create a field with items lookup and a field (set allowEdit to NO) which will display sales price. Then override modified() method on first field and fill sales price value.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,228 Super User 2024 Season 2
Martin Dráb 230,056 Most Valuable Professional
nmaenpaa 101,156