Function SET184S

LANSA

Function SET184S
* =======================================================;
* Process ........: SET_184;
* Function .......: SET184S;
* Created on .....: 26/07/00 at 14:43:32;
* Description ....:Changing input/output mode in a column;
* Version.........: 1;
*;
* Full Description: The purpose of this function is to;
* show how the mode of a browselist column can be;
* dynamically changed.;
* Sometimes you need a field to be input or output based;
* on the value of another field. This means you can't add;
* the input or output attribute to the field in the;
* DEF_LIST as you normally would. *IOCOND is not;
* supported in LANSA for the WEB.;
*;
* Disclaimer: The following material is supplied as an;
* example only. No warranty is expressed or implied.;
*;
* Receives: nothing;
*;
* =======================================================;
* Function control options;
FUNCTION OPTIONS(*DIRECT *WEBEVENT);
*;
* Group and field definitions;
*;
DEFINE FIELD(#S_184MODE) TYPE(*CHAR) LENGTH(001) LABEL('Mode');
* (This field is used to request the mode from the user.;
* It displayed via component SET184S which displays it;
* as a radio button.);
DEFINE FIELD(#S_184DESI) TYPE(*CHAR) LENGTH(001) COLHDG('Description');
* (This field holds the input/output mode for S_184DES.;
* Field #S_184DESI has an attached component S_184DESI;
* that displays field #S_184DES in the correct mode);
*;
GROUP_BY NAME(#S_GRPPANL) FIELDS((#S_184FDES *INPUT *NOID) (#STDRENTRY *HIDDEN) (#S_FUNDES *HIDDEN));
* (Field #S_184FDES has a component S_184FDES which;
* merges in a component with the same name as the;
* function (in this case component SET184S));
*;
DEF_LIST NAME(#S_184SFVC) FIELDS(#S_184CDE (#S_184DES *HIDDEN) #S_184DESI #S_184QTY #S_184UNIT #S_184UPRC #S_184TPRC);
DEF_LIST NAME(#S_WRKFVC) FIELDS(#S_184CDE #S_184DES #S_184QTY #S_184UNIT #S_184UPRC #S_184TPRC #S_184IMG) TYPE(*WORKING) ENTRYS(0000500);
*;
* Mainline;
*;
CHANGE FIELD(#S_FUNDES) TO(*FUNCTION_DESC);
*;
CASE OF_FIELD(#STDRENTRY);
WHEN VALUE_IS('= *BLANKS');
* first time in - populate list;
CHANGE FIELD(#STDRENTRY) TO(Y);
CLR_LIST NAMED(#S_184SFVC);
* Function SET184Y populates list #S_WRKFVC with data;
CALL PROCESS(*DIRECT) FUNCTION(SET184Y) PASS_LST(#S_WRKFVC);
SELECTLIST NAMED(#S_WRKFVC);
* Set mode for field #S_184DES to output;
CHANGE FIELD(#S_184DESI) TO(*NULL);
ADD_ENTRY TO_LIST(#S_184SFVC);
ENDSELECT;
* Set requested mode to output;
CHANGE FIELD(#S_184MODE) TO(*BLANKS);
*;
WHEN VALUE_IS('= Y');
* subsequent iteration;
* update the browselist based on the mode that the user;
* selected;
SELECTLIST NAMED(#S_184SFVC);
CHANGE FIELD(#S_184DESI) TO(#S_184MODE);
UPD_ENTRY IN_LIST(#S_184SFVC);
ENDSELECT;
ENDCASE;
*;
* Display the list and request the input/output mode;
*;
REQUEST FIELDS(#S_GRPPANL) BROWSELIST(#S_184SFVC) EXIT_KEY(*NO) MENU_KEY(*NO) PROMPT_KEY(*NO);
* Field #S_184DESI has an attached component. This;
* component displays #S_184DES in the mode based on the;
* contents of field #S_184DESI.;
*;
* Note that #S_184DESI has been defined *INPUT on the;
* DEF_LIST, to match the Visual Input component S_184DESI;