How to SetValue to *Visual_Host as field visualization

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
Taku Izumi
Posts: 70
Joined: Thu Dec 15, 2016 2:03 pm

How to SetValue to *Visual_Host as field visualization

Post by Taku Izumi »

Hi All,

I am trying to change the value of all fields on a form to *NULL from the #COM_OWNER.ComponentControls property.

Code: Select all


For Each(#Element) In(#COM_OWNER.ComponentControls)
If Cond(#Element *Is #PRIM_EVP)
#STD_TEXT := (#Element *As #prim_EVP).SetValue( *NULL )
Message Msgtxt('SetValue is ' + #STD_TEXT)
Endif
Endfor

But, if the field's Class is a visual host, this SetValue will return False.
Is there a way for SetValue to handle the value of fields where VisualHost is used?

Below is the code for a test case form using the xEmployeeSurname field and #xEmployeeSurnameAutoComplete reusable part included in the Visual LANSA sample.

Code: Select all

* **************************************************
*
*  COMPONENT:  STD_FORM
*
* **************************************************
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Clientwidth(669) Clientheight(153) Componentversion(2) Left(557) Top(214)

Define_Com Class(#xEmployeeSurname.AutoComplete) Name(#xEmployeeSurname) Displayposition(1) Left(28) Parent(#COM_OWNER) Tabposition(1) Top(37)
Define_Com Class(#PRIM_PHBN) Name(#Button1) Displayposition(2) Left(31) Parent(#COM_OWNER) Tabposition(2) Top(80) Caption('SetValue')
Define_Com Class(#PRIM_STBR) Name(#StatusBar1) Displayposition(3) Height(24) Left(0) Messageposition(1) Parent(#COM_OWNER) Tabposition(3) Tabstop(False) Top(129) Width(669)

Evtroutine Handling(#COM_OWNER.Initialize)
#xEmployeeSurname.Value := 'Unknow Employee'
Endroutine

Evtroutine Handling(#Button1.Click)

For Each(#Element) In(#COM_OWNER.ComponentControls)
If Cond(#Element *Is #PRIM_EVP)
#STD_TEXT := (#Element *As #prim_EVP).SetValue( *NULL )
Message Msgtxt('SetValue is ' + #STD_TEXT)
Endif
Endfor

Endroutine
End_Com

Best regards,
Taku
Post Reply