Use equates to fill a Clarion Drop List Control

by marc walgren26. March 2013 05:08

Drop Lists work well with a short list of choices, say 3-10. In the Clarion dictionary offers "Must be in List" on the validation tab. There are two parts to the list "Choices" and "Values". The list elements are entered and must be separated by the Pipe character (|).

The approach I favor is to use equates to build the choices/value lists and reference the equate from the particular control. Updating an equate does not require a full application rebuild (handy when developing a multi-dll app) and adding another value is really quick and easy.

Ok. A trival example. We have a system with a User table and each has a Type. (I these standards for the equates

! Equate Prefix: e_   "Equate"  -- Usually For Displaying
! Equate Prefix: v_   "Value"   -- Usually For "Value" stored In DB, like 1,2,3,ENG,SPA
! Equate Prefix: d_   "Default" -- Usually Default "Value"
! Equate Prefix: l_   "List"    -- Usually for Dropdown List

We define four user types and their associated values: (Notice the values are equated strings)

e_UserType_Standard    Equate('Standard')

v_UserType_Standard    Equate('1')

e_UserType_Manager     Equate('Manager')

v_UserType_Manager     Equate('2')

e_UserType_Admin     Equate('Admin')

v_UserType_Admin     Equate('3')

 

Let's equate the separator characters too.

e_bar             Equate('|')

e_hash            Equate('#')

e_BarHash         Equate(e_bar & e_hash)

Now build the equate for the drop list

l_UserType_opts     Equate(e_UserType_Standard & e_BarHash & v_UserType_Standard & e_Bar & |

                                        e_UserType_Manager & e_BarHash & v_UserType_Manager & e_Bar & |

                                        e_UserType_Admin & e_BarHash & v_UserType_Admin)

 

Reference the list equate in the From property of the list control.

LIST,AT(254,40,99,11),USE(Usr:UserType),DROP(10),FROM(l_UserType_opts)

 

Works really well.

 

Additions to the list are trivial. Add a couple equates and update the list equate and recompile.

Tags:

Clarion | Development

blog comments powered by Disqus

Contact Us  Consulting  Web Development  Data Collection  Flexible Web Lists  Clarion Products  Downloads  How To Order  Site Map  Store  Home
Copyright (c) 1989-2013 Mitten Software Inc., All rights reserved.

Month List