Files
St.Clair/MLMStripper/bin/Debug/FORM/FORM_SET_GENERIC_ITEM_LOGIC.mlm

284 lines
12 KiB
Plaintext

maintenance:
title: ;;
mlmname: FORM_SET_GENERIC_ITEM_LOGIC;;
arden: version 2.5;;
version: 0.00;;
institution: ;;
author: ;;
specialist: ;;
date: 2013-03-04;;
validation: testing;;
library:
purpose: Process the configuration for the generic MLM based on the MLMGenericItemControl value
;;
explanation:
change history
4-11-2013 STH - CSR 31297 - Update and validate the de-select logic section in the code to verify accuracy of functionality.
;;
keywords:
;;
knowledge:
type: data-driven;;
data:
(this_communication, // Communication object
this_form, // Form object
client_info_obj, //Arden ClientInfo object
mlmlogic, //mlm logic passed by g
itemselected, //if this is for item selected or not
matchconfig,
mfon
) := argument;
LegendIn := ();
LegendOut := ();
LegendIn := ("MOI","MOC","MOG","FO");
LegendOut := ("MultiOrderInline","MultiOrderCheckbox","MultiOrderGrid","FormOpen");
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}}; //used to parse string data into a list
;;
priority: 50
;;
evoke:
;;
logic:
field_list:= this_form.fields;
selectedfields:=();
//parse the MLM Logic into a list for each configuration section that needs processed
selectedfields:= call str_parse with mlmlogic,"|";
//cycle through each configuration logic section and act on the items based on the current calling
//item configuration status that matches the item(s) in the logic passed into the MLM
for j in (1 seqto count(selectedfields)) do
findconfigitem:= call str_parse with selectedfields[j],"_";
cfgcallitemdtl := call str_parse with findconfigitem[1],"^";
//set these variables equal to the specific item/segment of the configuration
if ((cfgcallitemdtl[1] = matchconfig) and ((cfgcallitemdtl[2] = mfon) or ((cfgcallitemdtl[2] as number) = (mfon as number)))) then
cfgupdateitemdtl := call str_parse with findconfigitem[2],"^";
cfgcallitemtype := cfgcallitemdtl[1];
cfgcallitemnum := cfgcallitemdtl[2];
cfgcallorders := call str_parse with cfgcallitemdtl[3],",";
cfgcallsingleonly := cfgcallitemdtl[4];
cfgupdateitemtype := cfgupdateitemdtl[1];
cfgupdateitemnum := cfgupdateitemdtl[2];
cfgupdateorders := call str_parse with cfgupdateitemdtl[3],",";
cfgupdateitemselect := cfgupdateitemdtl[4];
cfgupdateitemenable := cfgupdateitemdtl[5];
else
cfgupdateitemdtl := null;
cfgcallitemtype := null;
cfgcallitemnum := null;
cfgcallorders := null;
cfgcallsingleonly := null;
cfgupdateitemtype := null;
cfgupdateitemnum := null;
cfgupdateorders := null;
cfgupdateitemselect := null;
cfgupdateitemenable := null;
endif;
//this section will cycle through the LegendIn variable and attempt to match the configuration to one of the 3 options of MOG, MOC, MOI.
NumLegend:= count LegendIn;
update_itemlist := ();
tempupdate_itemslist := ();
for l in (1 seqto (NumLegend)) do
if LegendIn[l] = cfgupdateitemtype then
name:= LegendOut[l];
endif;
if LegendIn[l] = matchconfig then
callname := LegendOut[l];
endif;
enddo;
//if there is a valid configuration with MOG, MOI, or MOC then this section will build the update order items list that will need udpated
//based on the configuration that was added to MLMGenericItemControl data item on the order set form
if (name <> "") then
update_itemflds := last of (field_list where field_list.DataItemName = name
and field_List.Control_MultiFieldOccNum = (cfgupdateitemnum as number));
if cfgupdateorders[1] <> "" then
update_itemlist := update_itemflds.Value where update_itemflds.Value.Name in cfgupdateorders;
elseif cfgcallitemtype <> "" and cfgcallitemnum <> "" then
update_itemlist := update_itemflds.Value;
endif;
//build 3 lists for the update item(s) details that need updated
update_itemname := ();
update_itemcheck := ();
update_itemdisabled := ();
update_itemname := update_itemlist.name;
update_itemcheck := update_itemlist.IsSelected;
update_itemdisabled := update_itemlist.Isreadonly;
endif;
//This will set the selection status to NOSEL if the configuration in
//MLMGenericItemControl does not have a value in this position.
//if cfgupdateitemselect = "" then
// cfgupdateitemselect := "NOSEL";
//endif;
//check to make sure there are valid values in the MLMGenericItemControl that matches
//the logic in this if statement. This is the main update section for this MLM
if (cfgupdateitemselect in ("SEL","NOSEL","")) and cfgupdateitemenable in ("true","false","") then
callsamenamefound := false;
updatesamenamefound := false;
//check to see if the same order item name exists in both the
//configuration update section and the configuration call section
//indicating that this item is probably a "duplicate" same/name item
checkforsamenamecu := ();
checkforsamenamecu := true where cfgupdateorders is in cfgcallorders;
if (count(checkforsamenamecu) > 0) and cfgupdateitemenable <> "" then
callsamenamefound := true;
endif;
//check to see if the the items in the grid that are flagged as update items
//match the configuration update orders
checkforsamenameu := ();
checkforsamenameu := true where update_itemname is in cfgupdateorders;
if count(checkforsamenameu) > 1 then
updatesamenamefound := true;
endif;
//this sets the the 2 variables = true since FO (FormOpen) is an action
//and there is not selection value for FormOpen. Always assume if the
//configuration item is FO (FormOpen) that the values is selected to trigger MLM properly.
if (cfgcallitemtype = "FO") then
itemselected := true;
//updateitemselectedyn := true;
endif;
//This section will set a variable to the opposite boolean value
//of the calling item selection status. this allows for logic
//of opposite control (when selected de-select other items ect...
if itemselected = true then
opositeitemselected := false;
elseif itemselected = false then
opositeitemselected := true;
endif;
//autoselect/deselect item(s) without disabling when calling item selected/deselected
if cfgupdateitemselect = "SEL" and cfgupdateitemenable = "" then
update_itemlist.IsSelected := itemselected where update_itemlist.IsSelected = true or update_itemlist.IsSelected = false;
//SELnull := "test";
//break;
//autoselect/deselect and disable/enable items when calling item selected/deselected
elseif cfgupdateitemselect = "SEL" and cfgupdateitemenable = "false" then
if updatesamenamefound = false and callsamenamefound = false then
update_itemlist.IsSelected := itemselected where update_itemlist.IsSelected = true or update_itemlist.IsSelected = false;
update_itemlist.IsReadOnly := itemselected where update_itemlist.IsReadOnly = true or update_itemlist.IsReadOnly = false;
//SELfalsesingle := "test";
//break;
elseif updatesamenamefound = true or callsamenamefound = true then
for j in (1 seqto count(update_itemlist)) do
if ((update_itemlist[j].IsSelected = false and update_itemlist[j].IsReadOnly = false)
or (update_itemlist[j].IsSelected = true and update_itemlist[j].IsReadOnly = true)) then
update_itemlist[j].IsSelected := itemselected;
update_itemlist[j].IsReadOnly := itemselected;
endif;
enddo;
endif;
//autoselect/deselect items and enable/disable item(s) when calling item selected/de-selected
elseif cfgupdateitemselect = "SEL" and cfgupdateitemenable = "true" then
update_itemlist.IsSelected := itemselected where update_itemlist.IsSelected = true or update_itemlist.IsSelected = false;
update_itemlist.IsReadOnly := opositeitemselected where update_itemlist.IsReadOnly = true or update_itemlist.IsReadOnly = false;
//SELtrue := "test";
//break;
//autenable/disable item when calling item selected/de-selected without selecting the item
//when unchecking the calling item all items will be de-selected before disabling again
elseif cfgupdateitemselect = "NOSEL" and cfgupdateitemenable = "" then
update_itemlist.IsSelected := opositeitemselected where update_itemlist.IsSelected = true or update_itemlist.IsSelected = false;
elseif cfgupdateitemselect = "NOSEL" and cfgupdateitemenable = "true" then
update_itemlist.IsReadOnly := opositeitemselected where update_itemlist.IsReadOnly = true or update_itemlist.IsReadOnly = false;
update_itemlist.IsSelected := opositeitemselected where update_itemlist.IsSelected = true or update_itemlist.IsSelected = false;
elseif cfgupdateitemselect = "" and cfgupdateitemenable = "true" then
update_itemlist.IsReadOnly := opositeitemselected where update_itemlist.IsReadOnly = true or update_itemlist.IsReadOnly = false;
//check to see if opositieitemselected is true meaning the selected calling item is not selected. Since the logic
//says to "enable" this field when the calling item is selected the expecatation would be to disable and uncheck the itme
//if the calling item is de-selected
if opositeitemselected = true then
update_itemlist.IsSelected := false where update_itemlist.IsSelected = true or update_itemlist.IsSelected = false;
endif;
//autodisable and des-select item without selecting it preventing the user from selecting the item.
elseif (cfgupdateitemselect = "NOSEL" or cfgupdateitemselect = "") and cfgupdateitemenable = "false" then
if updatesamenamefound = false and callsamenamefound = false then
if itemselected = false then
update_itemlist.IsSelected := false where update_itemlist.IsReadOnly = true or update_itemlist.IsReadOnly = false;
endif;
update_itemlist.IsReadOnly := itemselected where update_itemlist.IsReadOnly = true or update_itemlist.IsReadOnly = false;
elseif updatesamenamefound = true or callsamenamefound = true then
for j in (1 seqto count(update_itemlist)) do
if ((update_itemlist[j].IsSelected = false and update_itemlist[j].IsReadOnly = false)
or (update_itemlist[j].IsSelected = false and update_itemlist[j].IsReadOnly = true)) then
update_itemlist[j].IsReadOnly := itemselected;
endif;
enddo;
endif;
endif;
endif;
//if the calling item is configured to restrict the item(s) in the list to be single item select only then this section
//will update all items defined in "call_itemlist2" to the opposite of the calling item(s) selections status.
//if you "select" or "check" any of the item(s) in the calling event then this section will disable all other items.
//if you "deselect" or "uncheck" any of the item(s) in the calling even then this section will enable all other items for available selection.
if (cfgcallitemtype <> "" and cfgcallitemnum <> "" and cfgcallsingleonly = "YES") then
update_itemlist := last of (field_list where field_list.DataItemName = callname
and field_List.Control_MultiFieldOccNum = (mfon as number));
update2_itemvalue := ();
update_itemvalue := ();
if cfgcallorders[1] = "" then
update_itemvalue := update_itemlist.Value;
else
for c in (1 seqto count(update_itemlist.Value)) do
for p in (1 seqto count(cfgcallorders)) do
if trim(cfgcallorders[p]) = trim(update_itemlist.Value[c].Name) then
update2_itemvalue := update2_itemvalue, update_itemlist.Value[c];
endif;
enddo;
enddo;
update_itemvalue := update2_itemvalue;
endif;
for h in (1 seqto count(update_itemvalue.IsReadOnly)) do
if itemselected = true and update_itemvalue[h].IsSelected = false and update_itemvalue[h].IsReadOnly = false then
update_itemvalue[h].IsReadOnly := true;
elseif itemselected = false and update_itemvalue[h].IsSelected = false and update_itemvalue[h].IsReadOnly = true then
update_itemvalue[h].IsReadOnly := false;
endif;
enddo;
endif;
enddo;
conclude true;
;;
action:
return this_communication, this_form;
;;
Urgency: 50;;
end: