Page 1 of 1

How to show a field as checkbox

Posted: Tue Jan 14, 2020 12:25 am
by alphabeta13
Hi,

I'm a LANSA Developer newbie, still need to learn a lot...

I have a requirement to show a field on the screen/page/form as a checkbox; the field itself can contain either ' ' (blank) or 'S'.
When it is 'S' we'd like the checkbox checked, and unchecked when it's ' '.

How to do this?

Thanks,
T.A.

Re: How to show a field as checkbox

Posted: Tue Jan 14, 2020 2:03 am
by lawingo
Open the Field in the Repository and click the Visualization tab. Here is the code I use.
I typically create an Alpha (1) field and use the below visualization.

Customize the N & Y to suite your needs.

Code: Select all

Begin_Com Role(*EXTENDS #PRIM_OBJT)

Begin_Com Role(*Visual #PRIM_EVEF) Name(#VisualEdit) Componentversion(1) Height(19) Usepicklist(False) Width(178)

End_Com

*  Picklist visualization Checkbox
Begin_Com Role(*Visual #PRIM_EVPL) Name(#CHECK) Appearance(CheckBox) Componentversion(1) Defaultvisual(True) Height(19) Width(209)

End_Com

Begin_Com Role(*picklist) Name(#Picklist) Nomatchaction(ShowValue)

Define_Com Class(#PRIM_PKIT) Name(#Item) Caption('N') Default(True) Parent(#Picklist) Value('N')

Define_Com Class(#PRIM_PKIT) Name(#Item_1) Caption('Y') Parent(#Picklist) Value('Y')
End_Com
End_Com

Re: How to show a field as checkbox

Posted: Wed Jan 15, 2020 1:55 am
by alphabeta13
Thanks Lawingo for your help, however I am still having problem, perhaps because I did not explain my question properly and also because of my very limited LANSA knowledge.

The field I was referring to was a field from an IBM i table. I cannot find option to define it as a checkbox.
When I tried to copy your code, I got lots of error messages. I am still trying to figure them out.

Regards,
T.A.

Re: How to show a field as checkbox

Posted: Wed Jan 15, 2020 6:40 am
by davidbalansa
I found this is the documentation searching for field visualizations:

https://docs.lansa.com/14/en/lansa013/c ... ef94685465

Re: How to show a field as checkbox

Posted: Wed Jan 15, 2020 8:24 am
by atostaine
alphabeta13 wrote:
Wed Jan 15, 2020 1:55 am
Thanks Lawingo for your help, however I am still having problem, perhaps because I did not explain my question properly and also because of my very limited LANSA knowledge.

The field I was referring to was a field from an IBM i table. I cannot find option to define it as a checkbox.
When I tried to copy your code, I got lots of error messages. I am still trying to figure them out.

Regards,
T.A.
The code lawingo sent was for a field visualisation. Did you open the field in the editor?

Re: How to show a field as checkbox

Posted: Thu Jan 16, 2020 7:16 am
by alphabeta13
Thank you all for your kind help.
I got it now.

Regards,
T.A.