How to show a field as checkbox

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
alphabeta13
Posts: 3
Joined: Tue Jan 14, 2020 12:18 am

How to show a field as checkbox

Post by alphabeta13 » Tue Jan 14, 2020 12:25 am

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.

User avatar
lawingo
Posts: 53
Joined: Fri Dec 04, 2015 6:41 am

Re: How to show a field as checkbox

Post by lawingo » Tue Jan 14, 2020 2:03 am

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

alphabeta13
Posts: 3
Joined: Tue Jan 14, 2020 12:18 am

Re: How to show a field as checkbox

Post by alphabeta13 » 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.

davidbalansa
Posts: 54
Joined: Mon Feb 01, 2016 10:08 am
Location: Australia

Re: How to show a field as checkbox

Post by davidbalansa » Wed Jan 15, 2020 6:40 am

I found this is the documentation searching for field visualizations:

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

atostaine
Posts: 475
Joined: Wed Jan 20, 2016 7:38 am

Re: How to show a field as checkbox

Post by atostaine » Wed Jan 15, 2020 8:24 am

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?
Art Tostaine

alphabeta13
Posts: 3
Joined: Tue Jan 14, 2020 12:18 am

Re: How to show a field as checkbox

Post by alphabeta13 » Thu Jan 16, 2020 7:16 am

Thank you all for your kind help.
I got it now.

Regards,
T.A.

Post Reply