Sorry - another Dexterity question. It seems I'm full of questions these days.
Thanks to Dave, I was able to find the correct spot to work out a script to populate my 2 added fields to the scrolling window in the SOP_Entry form via the following script:
Well I also need those fields to populate when the user types in a new item number - adding it to the order document.
I knew LINE_CHANGE wouldn't be the right trigger to attach to - as that runs when the line loses focus. The best place I figured would be the TRIGGER_FOCUS_CHANGE of the Item Number field within the scrolling window.
The script I have attached does indeed run, and I can get the entered Item Number and associated Location Code - but the table IV_Item_MSTR_QTYS is not locating the correct record.
I've tried setting the proper fields in the table, but it still doesn't update properly (tried watching the Local window during script debugger breakpoints).
Here are several variations of the script I've tried:
The next one is not optimal I know - as it opens a separate copy of the IV_Item_MSTR_QTYS tables locally for the script instead of just using the one already attached to the form. I had to try it anyway.
I've also tried the following one with variations of the get table line.
I've run out of ideas on how to populate the IV_Item_MSTR_QTYS table for this trigger. I'm probably missing something very simple.
Anyway someone can nudge me in the right direction? Thanks.
Thanks to Dave, I was able to find the correct spot to work out a script to populate my 2 added fields to the scrolling window in the SOP_Entry form via the following script:
Code:
{
Name: PDP_SOP_Entry_LineFill
Description: IV_Item_MSTR_QTYS contains the data we want.
It should already be set (according to debugger).
Run on TRIGGER_FOCUS_FILL (LINE_FILL)
}
'(L) PDP Qty On Hand' of window Line_Scroll of form SOP_Entry = 'QTY On Hand' of table IV_Item_MSTR_QTYS;
'(L) PDP Net Available' of window Line_Scroll of form SOP_Entry = 'QTY On Hand' of table IV_Item_MSTR_QTYS - 'QTY Allocated' of table IV_Item_MSTR_QTYS;
Well I also need those fields to populate when the user types in a new item number - adding it to the order document.
I knew LINE_CHANGE wouldn't be the right trigger to attach to - as that runs when the line loses focus. The best place I figured would be the TRIGGER_FOCUS_CHANGE of the Item Number field within the scrolling window.
The script I have attached does indeed run, and I can get the entered Item Number and associated Location Code - but the table IV_Item_MSTR_QTYS is not locating the correct record.
I've tried setting the proper fields in the table, but it still doesn't update properly (tried watching the Local window during script debugger breakpoints).
Here are several variations of the script I've tried:
Code:
{
Name: PDP_SOP_Entry_LineItemChange
Description: IV_Item_MSTR_QTYS contains the data we want.
Runs on Item Number change (TRIGGER_FOCUS_CHANGE)
in the scrolling window on form SOP_Entry
}
local string ITEMNMBR;
local string LOCNCODE;
ITEMNMBR = 'Item Number' of table SOP_LINE_WORK;
LOCNCODE = 'Location Code' of table SOP_LINE_WORK;
if not empty(ITEMNMBR) and not empty(LOCNCODE) then
'Item Number' of table IV_Item_MSTR_QTYS = ITEMNMBR;
'Location Code' of table IV_Item_MSTR_QTYS = LOCNCODE;
'(L) PDP Qty On Hand' of window Line_Scroll of form SOP_Entry = 'QTY On Hand' of table IV_Item_MSTR_QTYS;
'(L) PDP Net Available' of window Line_Scroll of form SOP_Entry = 'QTY On Hand' of table IV_Item_MSTR_QTYS - 'QTY Allocated' of table IV_Item_MSTR_QTYS;
end if;
Code:
{
Name: PDP_SOP_Entry_LineItemChange
Description: IV_Item_MSTR_QTYS contains the data we want.
Runs on Item Number change (TRIGGER_FOCUS_CHANGE)
in the scrolling window on form SOP_Entry
}
local string ITEMNMBR;
local string LOCNCODE;
local anonymous table IvTemp;
local string table_name;
table_name = "IV_Item_MSTR_QTYS";
ITEMNMBR = 'Item Number' of table SOP_LINE_WORK;
LOCNCODE = 'Location Code' of table SOP_LINE_WORK;
if not empty(ITEMNMBR) and not empty(LOCNCODE) then
open table IvTemp with name table_name;
set 'Item Number' of table IvTemp to ITEMNMBR;
set 'Location Code' of table IvTemp to LOCNCODE;
'(L) PDP Qty On Hand' of window Line_Scroll of form SOP_Entry = 'QTY On Hand' of table IvTemp;
'(L) PDP Net Available' of window Line_Scroll of form SOP_Entry = 'QTY On Hand' of table IvTemp - 'QTY Allocated' of table IvTemp;
end if;
Code:
{
Name: PDP_SOP_Entry_LineItemChange
Description: IV_Item_MSTR_QTYS contains the data we want.
Runs on Item Number change (TRIGGER_FOCUS_CHANGE)
in the scrolling window on form SOP_Entry
}
local string ITEMNMBR;
local string LOCNCODE;
ITEMNMBR = 'Item Number' of table SOP_LINE_WORK;
LOCNCODE = 'Location Code' of table SOP_LINE_WORK;
if not empty(ITEMNMBR) and not empty(LOCNCODE) then
set 'Item Number' of table IV_Item_MSTR_QTYS to ITEMNMBR;
set 'Location Code' of table IV_Item_MSTR_QTYS to LOCNCODE;
'(L) PDP Qty On Hand' of window Line_Scroll of form SOP_Entry = 'QTY On Hand' of table IV_Item_MSTR_QTYS;
'(L) PDP Net Available' of window Line_Scroll of form SOP_Entry = 'QTY On Hand' of table IV_Item_MSTR_QTYS - 'QTY Allocated' of table IV_Item_MSTR_QTYS;
end if;
Code:
{
Name: PDP_SOP_Entry_LineItemChange
Description: IV_Item_MSTR_QTYS contains the data we want.
Runs on Item Number change (TRIGGER_FOCUS_CHANGE)
in the scrolling window on form SOP_Entry
}
local string ITEMNMBR;
local string LOCNCODE;
ITEMNMBR = 'Item Number' of table SOP_LINE_WORK;
LOCNCODE = 'Location Code' of table SOP_LINE_WORK;
if not empty(ITEMNMBR) and not empty(LOCNCODE) then
set 'Item Number' of table IV_Item_MSTR_QTYS to ITEMNMBR;
set 'Location Code' of table IV_Item_MSTR_QTYS to LOCNCODE;
get table IV_Item_MSTR_QTYS;
'(L) PDP Qty On Hand' of window Line_Scroll of form SOP_Entry = 'QTY On Hand' of table IV_Item_MSTR_QTYS;
'(L) PDP Net Available' of window Line_Scroll of form SOP_Entry = 'QTY On Hand' of table IV_Item_MSTR_QTYS - 'QTY Allocated' of table IV_Item_MSTR_QTYS;
end if;
I've run out of ideas on how to populate the IV_Item_MSTR_QTYS table for this trigger. I'm probably missing something very simple.
Anyway someone can nudge me in the right direction? Thanks.