Example 1

* * This is an example of VLF.WEB hidden command.
* It is executed on the web server.
* It can coded in RDML or RDMLX format.

* Regardless of whether it is RDML or RDMLX it needs to use the
* VFX* series of built-in functions to communicate with the Framework
* manager.

Function Options(*DIRECT)

* Get the current instance list entry

Use Builtin(VFX) With_Args(GETCURRENTINSTANCE)

* Get AKEY3 because it contains the employee number

Use Builtin(VFX_GET) With_Args(AKEY3) To_Get(#EmpNo)

* Issue a message showing the employee number retrieved

Execute Subroutine(Showmsg) With_Parms('Employeee number selected is' #Empno)

* Make the message always be displayed in the web browser

Use Builtin(VFX_SET) With_Args(AVSHOWMESSAGES TRUE)

* Finished

Return

* Simple subroutine to issue a message onto program message queue

Subroutine Name(ShowMSG) Parms((#MSGDTA *RECEIVED) (#TEMP1 *RECEIVED))
Define Field(#Msgdta) Type(*char) Length(132)
Define Field(#Temp1) Type(*char) Length(132)
Use Builtin(BCONCAT) With_Args(#MSGDTA #TEMP1) To_Get(#MSGDTA)
Message Msgid(DCM9899) Msgf(DC@M01) Msgdta(#MsgDta)
Endroutine

Example 2

* =======================================================
* Description ...: Instance level Hidden Command Handle
*
* =======================================================
Function Options(*DIRECT)

* Simple Field and Group Definitions
* =======================================================
Define Field(#REVSD) Reffld(#VF_ELBOOL)
Def_Cond Name(*REVSD) Cond('#REVSD *EQ TRUE')

* Get the Employee number of the current instance
* and the revered flag.

Use Builtin(VFX) With_Args(GETCURRENTINSTANCE)

Use Builtin(VFX_GET) With_Args(AKEY1) To_Get(#EMPNO)

* Get the Name state from the clipboard

Use Builtin(VFX_RESTOREAVALUE) With_Args(*BLANKS PNCAFLT REVERSED #EMPNO) To_Get(#REVSD)

Use Builtin(VFX_TRACEAVALUE) With_Args('Employee name is surname first? ' #REVSD)

* Fetch information from the main file to fill in the
* header fields on the form

Fetch Fields(#SURNAME #GIVENAME) From_File(PSLMST) With_Key(#EMPNO)

* Put the names together in the reverse order

If Cond(*REVSD)

* Put the names together Given name first

Change Field(#UF_VISID2) To(#GIVENAME)
Use Builtin(BCONCAT) With_Args(#UF_VISID2 #SURNAME) To_Get(#UF_VISID2)

* Set the reversed flag

Change Field(#REVSD) To(FALSE)

Use Builtin(VFX_TRACEAVALUE) With_Args('Employee name has been reversed. Name is now ' #UF_VISID2)

Else

* Put the names together Surname first

Change Field(#UF_VISID2) To(#SURNAME)
Use Builtin(BCONCAT) With_Args(#UF_VISID2 #GIVENAME) To_Get(#UF_VISID2)

* Set the reversed flag

Change Field(#REVSD) To(TRUE)

Use Builtin(VFX_TRACEAVALUE) With_Args('Employee name is now surname first. Name is now ' #UF_VISID2)

Endif

* Update the name (Visual ID 2) to the instance list

Use Builtin(VFX) With_Args(BEGINLISTUPDATE)

* Set up the list entry details

Use Builtin(VFX_SET) With_Args(VISUALID1 #EMPNO VISUALID2 #UF_VISID2 AKEY1 #EMPNO)

Use Builtin(VFX_TRACEAVALUE) With_Args('Employee name is surname first? ' #REVSD)

* Add instance details to the instance list

Use Builtin(VFX) With_Args(ADDTOLIST)

* Instance list updating is now complete

Use Builtin(VFX) With_Args(ENDLISTUPDATE)

* Remember which way the name is presented

Use Builtin(VFX_SAVEAVALUE) With_Args(#REVSD PNCAFLT REVERSED #EMPNO)


  • No labels