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] Preset Combobox Value - Maintain

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Preset Combobox Value - Maintain
 Login/Join
 
Member
posted
Hi all,

I've done some research on this topic and found a good solution by AlanB concerning setting a combobox value when opening a form. To give some background on what I'm doing, I have a form for looking up data via an html table. When you click a link on any record I open a new form for updating the data or deleting the record. Instead of an edit field I would like to use a combobox so my users can choose an option. My current code does this, but what I would like to know is how can I set the Text and the Value of the combobox so that my users see a nice discription of what they are choosing rather than a code which is what is being sent by the original form. The combobox values are from a variable in which I hard code the values. Listed below is the code hopefully you guys can help me out.

Declare productStk / STACK OF A0 ;
.
.
.
Case GetProductIndex
productStk(1) = 'TS';
productStk(2) = 'TT';


compute prodcntr/i6;
ProductStk.FocIndex=-1;
repeat ProductStk.FocCount prodcntr=1;
if EditPlanStk.PLPRP8 eq productStk(prodcntr) then productStk.FocIndex = prodcntr;
if ProductStk.FocIndex gt -1 goto exitrepeat;
endrepeat prodcntr=prodcntr+1;

EndCase

Sorry if this has already been answered somewhere, but I looked and couldn't find a solution.

Thanks,
Jim

This message has been edited. Last edited by: Kerry,


WebFOCUS 7.6.5
Windows Server 2003
 
Posts: 8 | Registered: September 27, 2006Report This Post
Platinum Member
posted Hide Post
Jim,

How about:

Compute productStk(1).code/A2;
Compute productStk(1).desc/A12;

Compute productStk(1).code = 'TS';
Compute productStk(1).desc = '1st Prod type';
Compute productStk(2).code = 'TT';
Compute productStk(2).desc = '2nd Prod Type';
etc.

('productStk().code' will give you the user selected item once the page is submitted)

Or you could make up a small .dat file with the code/description pairs, then a Master file to describe it (SUFFIX=FIX), and EXEC a .fex to retrieve the data into your stack.

I call that a 'codelist', and use them extensively to populate drop downs with user friendly text, and still have the database codes available.

The .dat files are easy to update with a text editor when the items need changing.

This message has been edited. Last edited by: Dave Ayers,


Regards,
Dave

http://www.daveayers.com

WebFocus/Maintain 7.6.4-8
on Win2000 and 2003 Server
 
Posts: 165 | Location: Detroit Metro | Registered: September 17, 2003Report This Post
Virtuoso
posted Hide Post
Jim,

I use in my maintains almost the same method Dave is describing.
Most of the codes I use are stored in a cross reference database, together with their description. The users would like to be able to select either on the code or on the description, depending on the level of their knowledge. So I create a stack with the codes and the descriptions, like Dave does, and then add an extra field in which I concatenate both fields into a so-called display field, which I show in the combobox. What the users then will see is something like 'code - description' in the combobox. And of course I position the combobox so, that the current database value is pre-selected when I open the form.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Master
posted Hide Post
Morning Jim
Dave and Gerard have provided the answers that I would have given you. Just a warning. Be careful setting a Focindex to -1. I usually code:

Case GetProductIndex
Compute productStk(1).code/A2;
Compute productStk(1).desc/A12;

Compute productStk(1).code = 'TS';
Compute productStk(1).desc = '1st Prod type';
Compute productStk(2).code = 'TT';
Compute productStk(2).desc = '2nd Prod Type';


compute prodcntr/i6= 1;
repeat ProductStk.FocCount
if EditPlanStk.PLPRP8 eq productStk(prodcntr).code then
Begin
productStk.FocIndex = prodcntr;
Goto ExitRepeat
Endbegin
Compute prodcntr=prodcntr+1;
endrepeat
EndCase

But there are always a number of ways to get things done. And again, use ProductStk / Desc in the combobox and use ProductStk().code as the selection.

Mark
 
Posts: 663 | Location: New York | Registered: May 08, 2003Report This Post
Member
posted Hide Post
Thanks Dave and GamP for the replies.

Dave - I added the computes as listed in your post, but when I compile the procedure to run I'm getting this error:

Error [FOC03800] in 'plan_maintenance/Start.MAINTAIN' at or near line 4: Duplicate Declaration of global Variable PRODUCTSTK
Error [FOC03773] in 'plan_maintenance/Start': COMPILE failed with return code -3800

I put the computes inside my GetProductIndex Case. Should I be putting these somewhere else? Also, my Declare of ProductStk is in the Declaration section of Top. Even though I'm receiving an error at run time, in the project Explorer I can see the ProductStk stack at the bottom with the rest of my stacks with code and desc and fields. Any ideas?

Sorry guys I'm very new to Maintain and this is above me. Thanks for your help.


WebFOCUS 7.6.5
Windows Server 2003
 
Posts: 8 | Registered: September 27, 2006Report This Post
Virtuoso
posted Hide Post
Jim,

We meant you to do the computes in stead of the declare productStk.
It's either the declare or the compute. These two methods do not mix easily.
Remove the declare from the top of your maintain...


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Member
posted Hide Post
Thanks Mark and GamP. This is the first time I've done something like this and I was thinking the Declare created the stack and the computes created the fields and created records for the stack. I took the declare out and it's preselecting my combobox just fine.

Now for the next step of my novice quest.

Concerning my combobox, I selected from a variable for the edit list and chose productStk.desc. This combobox selection is bound to a variable called productval. When I do my update I move the value of productval to the appropriate field in my update stack. The value I'm expecting to get is the code for the corresponding desc. Instead I think I'm getting the focindex because I'm getting a number in my productval variable and not the code. It seems the text is being set correctly, but how do I set the value of the combobox?

Thanks again for all your help. If you're going to be at summit look me up and I'll buy you guys a drink.

Thanks,
Jim


WebFOCUS 7.6.5
Windows Server 2003
 
Posts: 8 | Registered: September 27, 2006Report This Post
Master
posted Hide Post
Hi Jim
For the most part, I never use the SelectedItem parameter from inside the MDE. After the user makes a selection, in your code just have:

Compute ProductVal = productStk().code;

This is assuming that you are using productStk to populate your combobox. The shorthand () is actually the same as productstk.focindex. So, in that compute, you are assigning ProductVal to the code value of the row that was selected in the combobox.

Please let me know if you have any other questions. Also, since I like to keep track of these things, if you don't mind me asking, who are you developing for?

Thanks
Mark
 
Posts: 663 | Location: New York | Registered: May 08, 2003Report This Post
Platinum Member
posted Hide Post
Jim,

When you bind the output of the combobox to a variable you want to select the 'text' radio button in the dialog.

I usually select 'Value', and use the variable as the selected focindex, ie:
result = someStk(SelVar).field

That way I can use whichever stack field I wish.

'Text' gives you the displayed text value, and 'Value' gives you the row number of the selection - very different results, and not well explained Frowner
But do it whichever way you like.

As to declaring your stack fields, If you generate your variable through the GUI, they will be written as Declare's, above the Top Case

I prefer to hard code mine as Compute's, in the Top Case, and then load the stack values in a Load_Stacks Case, but again, your choice.


Regards,
Dave

http://www.daveayers.com

WebFocus/Maintain 7.6.4-8
on Win2000 and 2003 Server
 
Posts: 165 | Location: Detroit Metro | Registered: September 17, 2003Report This Post
Member
posted Hide Post
Mark,

While waiting for a response I did some thinking and did exactly what you just posted. As I mentioned before I'm moving the value of my combobox to my update stack, so in that compute instead of using the variable i was binding to I used productStk(productStk.FocIndex).code. I was about to post asking if this is the perferred method in this situation. In short it works like a champ. I appreciate all the help from you guys and I think I'm good to go.

Mark to give you some background I'm the IT Manager for Toppan Interamerica Inc. a Japanese printing company in McDonough, Ga (30min S of Atlanta). We've been a WebFOCUS customer for 8 years and we just purchased a Maintain liscense earlier this year. We were using Lotus Domino for our web application development, but I made the decision to switch to maintain. Now I'm getting my feet wet as this is my first maintain app. I've been through the Maintain Getting Started tutorial and I attended your Maintain labs at Summit last year. So far I'm really liking what I'm seeing and this forum community is just icing on the cake.

Dave, GamP, and Mark thanks again for your help.


WebFOCUS 7.6.5
Windows Server 2003
 
Posts: 8 | Registered: September 27, 2006Report This Post
Platinum Member
posted Hide Post
Jim,

Glad to have you aboard the Maintain train Smiler

It sounds like you are learning fast, and I look forward to more of your questions, so we can talk about some good Maintain techniques, and add them to the Focal Point database.

Perhaps something like putting together a 'Maintain Best Practices' guide !

GamP,

We are moving from that kind of data embedded in .mnt's and in some simple .foc's, to a position where we can move it all into SQL Server. So its just a transitional step. Besides, it's very easy to manage the data in flat files !

There's a lot of old code moving from 5.3 AIX to 7.6 on Windows - Great Fun Eeker

This message has been edited. Last edited by: Dave Ayers,


Regards,
Dave

http://www.daveayers.com

WebFocus/Maintain 7.6.4-8
on Win2000 and 2003 Server
 
Posts: 165 | Location: Detroit Metro | Registered: September 17, 2003Report This Post
Virtuoso
posted Hide Post
Maintain BP - Just a great idea!
Mark: can we do something like this?

In my experience moving code form one platform to the other is no problem at all. Even moving from lower release levels to newer is no problem. It all runs fine. One exception is if you try to run a 765 (or higher) maintain in a lower version - that won't work because of changes made to 765.
For one of my clients I create maintains on my PC with windows xp and sql server 2005 under 764. I then move the app to mainframe running 713 and db2, without any change at all. I love this product....


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Master
posted Hide Post
I would LOVE to put together a best practices guide. It has been a number of releases / years since one has been made. I will look into it here to see what needs to be done.

Mark
 
Posts: 663 | Location: New York | Registered: May 08, 2003Report 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] Preset Combobox Value - Maintain

Copyright © 1996-2020 Information Builders