Initial Checking with all 820 MLMs
This commit is contained in:
149
MLMStripper/bin/Debug/UTIL/UTIL_ITEMS_READONLY.mlm
Normal file
149
MLMStripper/bin/Debug/UTIL/UTIL_ITEMS_READONLY.mlm
Normal file
@@ -0,0 +1,149 @@
|
||||
maintenance:
|
||||
|
||||
title: List Setting MLM ;;
|
||||
mlmname: UTIL_ITEMS_READONLY;;
|
||||
arden: version 2;;
|
||||
version: 5.00;;
|
||||
institution: Eclipsys Corporation at SCH;;
|
||||
author: Shawn Head Eclipsys at St Clair Ext 7468;;
|
||||
specialist: ;;
|
||||
date: 2012-05-24;;
|
||||
validation: testing;;
|
||||
|
||||
library:
|
||||
purpose:
|
||||
Takes a list and the passed in value(s) to set all fields to correct read-only
|
||||
Returns a list with the correct amount of members all set to the necessary readonly status
|
||||
;;
|
||||
explanation:
|
||||
;;
|
||||
keywords:
|
||||
;;
|
||||
knowledge:
|
||||
type: data-driven;;
|
||||
data:
|
||||
( listallitems,
|
||||
listselected,
|
||||
listtriggeritems,
|
||||
currentreadonly
|
||||
|
||||
|
||||
) := ARGUMENT;
|
||||
|
||||
str_parse := mlm {{{SINGLE-QUOTE}}}UTIL_STRING_PARSE{{{SINGLE-QUOTE}}};
|
||||
;;
|
||||
evoke: /* Call MLM */
|
||||
;;
|
||||
logic:
|
||||
|
||||
|
||||
//counts the number of items in the grid AND the number of items that should control the MLM that were passed in
|
||||
ctallitems := count listallitems;
|
||||
cttriggeritems := count listtriggeritems;
|
||||
|
||||
|
||||
//builds a couple lists that will be used by the MLM to control the read only status
|
||||
isitemreadonly := ();
|
||||
switchro := ();
|
||||
isitemselected := "no";
|
||||
|
||||
//if there are no items configured in the MLMGenericItemControl for specific order items then this section
|
||||
//will only allow 1 item to be selected and will cause the readonly value to be set to true for all items
|
||||
//EXCEPT for the item that is currently selected in the grid. If no items are selected then the readonly value
|
||||
//will be set to the "isitemselected" value of NO allowing for any item to be selected again.
|
||||
|
||||
/* original
|
||||
if listtriggeritems[1] = "" or listtriggeritems[1] is null then
|
||||
for x in (1 seqto (count listselected)) do
|
||||
break;
|
||||
if listselected[x] = true then
|
||||
switchro := switchro, false;
|
||||
isitemselected := "yes";
|
||||
else
|
||||
switchro := switchro, true;
|
||||
endif;
|
||||
|
||||
enddo;
|
||||
break;
|
||||
if isitemselected <> "yes" then
|
||||
switchro := listselected;
|
||||
|
||||
endif;
|
||||
*/
|
||||
if listtriggeritems[1] = "" or listtriggeritems[1] is null then
|
||||
for x in (1 seqto (count listallitems)) do
|
||||
if listallitems[x] = true then
|
||||
switchro := switchro, false;
|
||||
isitemselected := "yes";
|
||||
else
|
||||
switchro := switchro, true;
|
||||
endif;
|
||||
|
||||
enddo;
|
||||
if isitemselected <> "yes" then
|
||||
switchro := listallitems;
|
||||
endif;
|
||||
else
|
||||
|
||||
//if there are items configured in MLMGenericItemControl for specific order items to trigger the read-only
|
||||
//option based on the required configuration then this logic will set all items that are not selected to
|
||||
//read only. This will be based on the fact that only 1 item at a time should be selectable based on the
|
||||
//order item list based into the MLM from MLMGenericItemControl (e.x. format would be MOG^7^order1, order2, order3^YES)
|
||||
|
||||
updateitempos := ();
|
||||
selecteditempos := ();
|
||||
isitemreadonly := currentreadonly;
|
||||
isitemselected := "no";
|
||||
|
||||
//this for loop cycles through the trigger order items that are configured in the MLMGenericItemControl
|
||||
for x in (1 seqto (count listtriggeritems)) do
|
||||
//this for loop cycles through ALL items in the grid that called the MLM so it can verify if the item configured
|
||||
//in the MLMGenericItemControl exists in the grid calling the MLM.
|
||||
for y in (1 seqto (count listallitems)) do
|
||||
//this if logic is making sure that the item in the configuration of MLMGenericItemControl matches the grid item
|
||||
//added to the form. If it matches 1-to-1 then it will check to see if the item is selected.
|
||||
if trim(listtriggeritems[x]) = trim(listallitems[y]) then
|
||||
//if the item is selected add the item position in the list to selecteditempos for later use.
|
||||
if listselected[y] = true then
|
||||
isitemselected := "yes";
|
||||
selecteditempos := selecteditempos, y;
|
||||
//if the item is NOT selected add the item position in the list to updateitempos for later use.
|
||||
else
|
||||
updateitempos := updateitempos, y;
|
||||
endif;
|
||||
endif;
|
||||
enddo;
|
||||
enddo;
|
||||
|
||||
|
||||
//now the MLM will check to see if there is an item selected in the grid. if so then it will update all the
|
||||
//selected items that are configured in the MLMGenericItemControl to NOT be read only so you can still
|
||||
//modify/unselect the item. It will also update all the items thAt are not selected to readonly preventing
|
||||
//those items from being selected until the selected item is "de-selected".
|
||||
if isitemselected = "yes" then
|
||||
for x in (1 seqto (count selecteditempos)) do
|
||||
isitemreadonly[updateitempos[x]] := false;
|
||||
enddo;
|
||||
for x in (1 seqto (count updateitempos)) do
|
||||
isitemreadonly[updateitempos[x]] := true;
|
||||
enddo;
|
||||
else
|
||||
//if there are no items selected as defined by the "isitemselected" variable then the MLM will set all items
|
||||
//configured in the MLMGenericItemControl to NOT be read only allowing for any item to be selected again.
|
||||
for x in (1 seqto (count updateitempos)) do
|
||||
isitemreadonly[updateitempos[x]] := false;
|
||||
enddo;
|
||||
endif;
|
||||
|
||||
switchro := isitemreadonly;
|
||||
endif;
|
||||
|
||||
conclude true;
|
||||
;;
|
||||
action:
|
||||
|
||||
return switchro;
|
||||
|
||||
;;
|
||||
Urgency: 50;;
|
||||
end:
|
||||
Reference in New Issue
Block a user