// Use Spec0008.utl // Small arrays with integer Codes (Dictionaries) // Template: // // object oSomething is a cIntegerCodeToText // IntegerCodeList // Define_IntegerCode XXX_SOMETHINGGOOD "Good" // Define_IntegerCode XXX_SOMETHINGFAIR "Fair" // Define_IntegerCode XXX_SOMETHINGNICE "Nice" // End_IntegerCodeList // end_object Use Base.nui // Item_Property command, Various macros (FOR_EX...), cArray, cSet and cStack classes class cIntegerCodeToText is a cArray item_property_list item_property integer piCode.i item_property string psText.i end_item_property_list cIntegerCodeToText procedure add_code.is integer iCode string sText integer iRow get row_count to iRow set piCode.i iRow to iCode set psText.i iRow to sText end_procedure function sText.i integer iCode returns string integer iMax iRow get row_count to iMax for iRow from 0 to (iMax-1) if iCode eq (piCode.i(self,iRow)) function_return (psText.i(self,iRow)) loop function_return "" end_function function iFindCode.s string lsValue returns integer integer liMax liRow get row_count to liMax for liRow from 0 to (liMax-1) if (uppercase(lsValue)=uppercase(psText.i(self,liRow))) function_return (piCode.i(self,liRow)) loop function_return -1 end_function register_procedure Add_Table_Value String sData String sDescr Integer iRec procedure Fill_DescriptionValidationTable integer iObj integer iMax iRow get row_count to iMax decrement iMax for iRow from 0 to iMax send Add_Table_Value to iObj (piCode.i(self,iRow)) (psText.i(self,iRow)) loop end_procedure function iFindIndexFromCode.i integer liCode returns integer integer liMax liRow get row_count to liMax decrement liMax for liRow from 0 to liMax if liCode eq (piCode.i(self,liRow)) function_return liRow loop function_return -1 end_function end_class #COMMAND IntegerCodeList enumeration_list #ENDCOMMAND #COMMAND End_IntegerCodeList end_enumeration_list #ENDCOMMAND #COMMAND Define_IntegerCode define !1 send add_code.is !1 !2 #ENDCOMMAND