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     Preselect Combobox value on Maintain - I'm still confused...

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Preselect Combobox value on Maintain - I'm still confused...
 Login/Join
 
Guru
posted
I have read several documentation on the combobox in Maintain as well as some Focal Point discussion on the topic but I am still confused.

This is what I'm trying to do. I have a single-select combobox on a form that is bound to a field in a stack. The options for this combobox is added by using the "As Entered Here" radio button on the list property. I manually entered the Text and its corresponding value in the property.

Adding a new record works fine (just like the other focal point post on this same subject). Now, I want to update (okay, don't roll your eyes just yet). The stack is now filled with the current value on the database. And so, the doc says not to bind this thing to a pre-filled stack because it will just overwrite what is in there. So, I bound this combobox to a scratch variable instead and created a hidden textbox that is bound to the stack field. after the "update button" is clicked, then it copies the value of the variable to the stack. It makes sense theoritically.

So, my first problem is setting the selectedIndex to the proper value before the form is shown. The example on the doc says to put the options in a stack, cycle through it on winform show_inactive, yada yada. Well, in my case, the options are not in a stack - they're manually entered in the "As Entered Here" thingee. So, what I did instead is to put a javascript on the form onload event and did something like this (okay, this is off the top of my head, so syntax errors may occur, but the point is the logic, not the syntax):

for(i=0;i "less than" document.form1.mycombobox.length;i++){
if (document.form1.mycombobox.options(i).value == document.form1.stackfield.value){
document.form1.mycombobox.selectedIndex = i;}
}

** the less than symbol doesn't show up right in the post, but y'all probably already know that.

Well, this didn't work - because, for some crazy reason, if I do a view source on the form when it runs, the actual VALUE of the options are changed to selectedIndex+1! So, it will never be the same as the value of the stackfield.

If I look at the .mnt file using notepad, the value for the options is what it should be, so I guess webfocus changes it at run-time/compile time somehow.

So, I guess this is not the way to do it... what's an easy way to do this?

I'm on 7.1.4 running on windows.


WF 8.1.05 Windows
 
Posts: 333 | Location: Orlando, FL | Registered: October 17, 2006Report This Post
Virtuoso
posted Hide Post
Firstly, I don't quite do this the way you describe. The way I approach this is to set up a stack of the variables that I want in the combo box.
   
.
.
Declare comboOptionStack/Stack of a0;
Declare comboOptionStackIndex/i6;
.
.
comboOptionStack(1)='myOption1';
comboOptionStack(2)='myOption2';
comboOptionStack(3)='myOption3';
.
.

Then I insert list items into the combo box from this Stack. I bind the combo box value to comboOptionStackIndex;

In the add or update record I will use:
recordStack.fieldNameForOption(1)=comboOptionStack(comboOptionStackIndex)
.
.


When I get a record for update into recordStack, then I use the same technique that I used for MikeM a few posting ago to display the right value.
Case GetStackIndex
Declare cntr/i6;
comboOptionStack.FocIndex=-1;
repeat comboOptionStack.FocCount cntr=1;
if (recordStack.fieldNameForOption(1) eq comboOptionStack(cntr) then comboOptionStack.FocIndex = cntr;
if comboOptionStack.FocIndex gt -1 goto exitrepeat;
endrepeat cntr=cntr+1;
EndCase



Hope this helps.

This message has been edited. Last edited by: Alan B,


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Guru
posted Hide Post
Hi Alan,

I'm still digesting this. It is a wee bit much for one combobox, no? But then if it is worth doing, it is worth doing right...
Just one question. If you have a combobox value different from the text, do you then put the text as a another field in the comboOptionsStack?


WF 8.1.05 Windows
 
Posts: 333 | Location: Orlando, FL | Registered: October 17, 2006Report This Post
Virtuoso
posted Hide Post
You're right, it is a bit much for a combobox, but they are a bit more complicated than a plain edit box. You get used to it.

And yes, after the endrepeat put in something like:
if comboOptionStack.FocIndex eq -1 begin
comboOptionStack(comboOptionStack.FocCount+1)=recordStack.fieldNameForOption(1);
comboOptionStack.FocIndex = comboOptionStack.FocCount;
endbegin

Don't forget to reset the stack afterwards though.
good luck.

This message has been edited. Last edited by: Alan B,


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report 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     Preselect Combobox value on Maintain - I'm still confused...

Copyright © 1996-2020 Information Builders