Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]Maintain - ComboBox

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]Maintain - ComboBox
 Login/Join
 
Guru
posted
I am new at Maintain. I have a form that has a comborbox with the values BLANK, Y, N. When I try and display the data, the combobox stays BLANK. I also create a test editbox and it displays the N. Both objects are attached to the same field. Is there another property I need to set on the combobox?

I can send an image of the property settings, if anyone is interested.

This message has been edited. Last edited by: Jay Potter,


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Report This Post
Virtuoso
posted Hide Post
If I can clarify what you are trying to do, I think that the ComboBox has 3 static values, when retrieving a record and then displaying on the screen, you are expecting the ComboBox to show the value of a retrieved field.

The result of a ComboBox selection from the screen can be bound to a variable, however the initial display of the ComboBox value is dependent on setting the FocIndex of the Stack that is used to populate the ComboBox. This is different than when using an editBox which is used to display and retrieve only single values. This means that binding to a single value will display that value and the value can then be populated from the returned value from the screen.

Displaying the correct comboBox value can be achieved using something like this where the values are coming from a stack, which is the best approach:
case top
comboboxStack(1).field = ' ';
comboboxStack(2).field = 'Y';
comboboxStack(3).field = 'N';
.
.
.
setCombo();
.
.
.
Case setCombo
comboboxStack.FocIndex = 1;
repeat comboboxStack.Foccount i/i4=1;
  if incomingfield eq comboboxStack(i).field begin
    comboboxStack.FocIndex = i;
    goto exitrepeat;
  endbegin
endrepeat i=i+1;
EndCase

Ensure you populate the ComboBox from comboboxStack and bind back to incomingfield.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Guru
posted Hide Post
Thanks for the informationI was afraid I would have to manually load the combobox. I manually loaded the list of items using the GUI into the ListItems area. I did not use a stack. My combox name is AdPlanLabelsCombo. I tried replacing comboboxStack with AdPlanLabelsCombo and that didn't work. What is my comboboxStack if I manually added them in?


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Report This Post
Virtuoso
posted Hide Post
In which case you should use something like:
.
.
.
Winform show_inactive formname
var/i1 = if incomingfield eq 'Y' then 2 else
         if incomingfield eq 'N' then 3 else 1;
  Formname.ControlName.ListItems.FocIndex=var;
.
.
.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Guru
posted Hide Post
Thanks that worked for me. But Itried this below and it worked. Any reason why I should use a variable first and assign it to the FocIndex or is it ok to go straight to the FocIndex.

Formname.ControlName.ListItems.FocIndex = if incomingfield eq 'Y' then 2 else
if incomingfield eq 'N' then 3 else 1;


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Report This Post
Virtuoso
posted Hide Post
None at all, it is just a matter of preference. However, by having the focindex value in a variable it makes it easier to know if that value was changed when returned from the form.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Guru
posted Hide Post
Good point! I have to decide whether I check all the fields before I decide to update or always update the whole file whether changes were made or not. It depends on whether they want an audit trail.


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Report This Post
Master
posted Hide Post
Just my two cents...

I would always prefer to load a combo box with a stack as opposed to hard coding in the object. That goes for all the objects on the form. It's just easier to preset and retrieve the values. Also, if you ever need to change the list it's easier to do it in the code than on the form.

Mark
 
Posts: 663 | Location: New York | Registered: May 08, 2003Report This Post
Guru
posted Hide Post
If I were to do that. How do I infer into a stack? Do I use a bogus datasource? Also what command do I use if I want to use 2 fields in the list? 1 to display a value and the other is the real value?


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Report This Post
Virtuoso
posted Hide Post
INFER is used for data sources. You can create stacks on the fly:
.
.
.
Case Top
stackname.field1/a4;
stackname.field2/a12;
stackname(1).field1 = 'DSC1';
stackname(1).field2 = 'Description1';
stackname(2).field1 = 'DSC2';
stackname(2).field2 = 'Description2';
stackname(3).field1 = 'DSC3';
stackname(3).field2 = 'Description3';
.
.
.
EndCase


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Guru
posted Hide Post
I appreciate your help so far. I am almost done with my form which is full of commboboxes. I am using the code below after I have reloaded a combobox. The perform GatherData works exactly as expected and the stack is sitting on the right record, but combobox is displaying the first record in the list. I have tried to attached the SelectedItem to one the the stack's fields and to a variable. Neither way seems to work. What am I missing?


IF cust_no NE '' THEN BEGIN

Form1.CustomerNumberBox.ListItems.FocIndex = 1;
REPEAT CustomerStk.Foccount i/i4=1;
IF cust_no EQ CustomerStk(i).ib_ffdcusn BEGIN
Form1.CustomerNumberBox.ListItems.FocIndex = i;
PERFORM GatherData ;
GOTO EXITREPEAT;
ENDBEGIN
i=i+1;
ENDREPEAT

ENDBEGIN


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Report This Post
Virtuoso
posted Hide Post
I would think that the form is missing its assertion:

winform show_inactive form1;

This, amongst many other things, is why Mark advises to use Stacks for data items rather than hard coding. A stance that I wholly agree with.

When setting the FocIndex on a Stack, rather than on a form object, it is a data action and is not dependant upon any one form being available.

It is best practice to keep the content and presentation layers separate. The whole program becomes more manageable, and with larger Maintains this is essential.

Additionally, and this is my preference only, I never use the words PERFORM, THEN (except in expressions) or COMPUTE.

I do use, but rarely see elsewhere, CLASS objects. These can be extremely powerful. IMO the training and documentation of CLASSES does not give a clear incentive to use them though.

Also, when creating programs, it is not essential to always DECLARE every variable at a global level, many variables are local to a case (function) and can have a DECLARE section within that case. Local variables can be passed to further cases which TAKE these values and may RETURN a result. This type of coding makes Maintain a very powerful language.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Guru
posted Hide Post
Thank you for all your suggestions! I will be updating my code to load the comboboxes via the code. The reloading of the combobox is all set. I was usinmg a wrong command. Mark saw I was having problems and he logged on my machine fixed it for me.


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]Maintain - ComboBox

Copyright © 1996-2020 Information Builders