New Ranks & Badges For The Community!
Notice something different? The ranks and associated badges have gone "Star Fleet". See what they all mean HERE
Highlighted
Commander Commander
Commander
1926 views

Query globallist display values in a label in the forms designer

Jump to solution

Hello,

 

does anyone know if there is a way to query specific array elements of a globallist in a form to be displayed in a label?

 

Example:

We have a globallist variable $G.test.disp with the values {"One", "Two", "Four", "Five"} and want to put "Two" in a label at a form.

 

In the RAD Debugger I can query the value with:

 

>d 2 in $G.test.disp
Two

 

But how can I query it in the forms designer?

 

I've tried:

$G.test.disp(2) => Result: Emtpy

$G.test.disp[2] => Result: Emtpy

2 in $G.test.disp  => Result: Emtp

$G.test.disp > Result: "One

 

Thanks!

Robert

0 Likes
1 Solution

Accepted Solutions
Highlighted
Commander Commander
Commander

Hello,

 

thank you for your detailled response.

 

The goal was to localize the value of a few labels. I planned to save them in a globallist and then localize that list.

 

With your suggestions I figured out a better way then using gl:

 

I saved the values in the scmessage table and added a new calculation to the format control:

$G.example=scmsg("1", "example_class")

 

Since the scmessages table is localizable I can just use $G.example in the forms designer and get the correct language value.

 

Thanks again!

View solution in original post

0 Likes
4 Replies
Highlighted
Absent Member.
Absent Member.

Hi Robert...is the goal to dynamically change the Label on the format while users interact with it?

 

There are several documents on DVD (Dynamic View Dependencies) in the Help Server. Additionally, there is a form named "dep.g" (accessed via Forms Designer) which has examples of various DVD configurations. An important configuration item is that any field or variable used in a DVD expression needs to be on the format.

 

The Caption Condition property of the Label control provides the option to dynamically change what is displayed. The syntax for this DVD statement (known as "field value matching") is included below:

 

FIELD ? ValueList : DisplayList

 

where FIELD is any variable or file field surrounded by square brackets and the ValueList/Display are comma-separated lists of values.

 

Example where the Label's Caption changes based on the value in the severity field:

[severity] ? "1","2","3","4" : "One","Two","Three","Four","None"

 

Unfortunately, I'm not aware of a working configuration where the hard-coded list is replaced with a global variable (with this type of DVD statement).

 

If the primary need is to specify the value when first entering the form, then another option is to build a thread/global variable in Format Control Calculations or Display Screen expressions.

 

Example in Format Control Calculations:

Initial: true

Calculation: $G.custom.label=2 in $G.test.disp

 

Note: Using global/thread variables typically means the solution needs to manage the creation and cleanup of the variables

Did you try $G.test.disp,2 - you hcan normally use a comma and then the index to reference a specific element of an array.
Highlighted
Commander Commander
Commander

Hello,

 

thank you for your detailled response.

 

The goal was to localize the value of a few labels. I planned to save them in a globallist and then localize that list.

 

With your suggestions I figured out a better way then using gl:

 

I saved the values in the scmessage table and added a new calculation to the format control:

$G.example=scmsg("1", "example_class")

 

Since the scmessages table is localizable I can just use $G.example in the forms designer and get the correct language value.

 

Thanks again!

View solution in original post

0 Likes
Highlighted
Commander Commander
Commander

@randallfharvey:

Just tried it, results in an emtpy label aswell.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.