combo box

  
How to change the default vaule in a combo box, I don`t want the first one as the default value.
Is there any ways to change it? Thanks a lot.
In Combo box you can change this value in special List, with value1 = 0 and option1 = ""...It is what you need?
Solution
Eric,

The combobox will show whatever the value of the variable bound to it has. So if you set the value of that variable in the preparation, the combobox will reflect this.
Solution
Kilian Hekhuis wrote:
Eric,

The combobox will show whatever the value of the variable bound to it has. So if you set the value of that variable in the preparation, the combobox will reflect this.
 Hi Kilian,
I`m sorry, I didn`t explain clearly.
Here is the combobox, it`s a selection table
1
2
3
4
5.....
As you know, when you open the webpage, it default set the "1" as the default value in the combox.
So I want use a function`s return value as the default value. If the return value is "3", then when you open
the webpage, the 3 will defaulted select in the combox.
How can I get that.
 
Hi Eric,

I just told you :). The combobox is bound to a variable. If you set that variable, e.g. in the preparation, the combobox will display that value.
Kilian Hekhuis wrote:
Hi Eric,

I just told you :). The combobox is bound to a variable. If you set that variable, e.g. in the preparation, the combobox will display that value.
 Hi Kilian,

I know it. Actually, I don`t want to change the variable.
In the selection table, if you don`t select a value, which is the defult? I think it should be the first value.
e.g. How can I set the last value in the table as the defaul.

 
Kilian Hekhuis wrote:
Hi Eric,

I just told you :). The combobox is bound to a variable. If you set that variable, e.g. in the preparation, the combobox will display that value.
List_Navigation_GetStartIndex
This action solve my issue. It can change the defult index in the combo box.
 
Hi Eric,

The default value is the value that is selected when the user doesn't make a choice. So if you have X, Y and Z as options, and the default is Y, you want the variable to store the user's choice also contain Y. If it contains X, the user will be confused. Perhaps I misunderstand your usecase, but setting the visible value to something different from the variable isn't a good idea.
Kilian Hekhuis wrote:
Hi Eric,

The default value is the value that is selected when the user doesn't make a choice. So if you have X, Y and Z as options, and the default is Y, you want the variable to store the user's choice also contain Y. If it contains X, the user will be confused. Perhaps I misunderstand your usecase, but setting the visible value to something different from the variable isn't a good idea.
 Hi Kilian,

Thanks a lot for the reply. Yes, this is my question. If I have X,Y and Z as options.
I think the first word X should be as the default. But I have met a issue, I added an op on the data source.
Now, the last word Z was set as the default. I want set it back, make the first word as the default.
I tried to use the "List_Navigation_GetStartIndex", but it not work.
How can I change it back?  Now the CurrentRowNumber default set to the max value, I want change it back to 0.
Hi eric,

I'll try to explain it one last time, of that fails, I think I'm not the person that can make you get this :). First I want to say that I don't understand why you are talking about List_Navigation_GetStartIndex and CurrentRowNumber: these are not for Combo Boxes, but for Table Records. Don't use them for Combo Boxes, period. Now onto the (hopefully) useful information:

A combo box has a number of properties that are interesting for this use case. I've created an example below. There's the Source Record List, the Source Attribute and the Variable. There's also the optional Special Variable and the associated Special List:



The start of it all is the Source Record List (which should really be renamed to Source List). This List determines both what is available to be shown in the combobox to the user (the Source Attribute), and whether you can specify what attribute's value is to be put in the Variable (the Source Identifier Attribute). The rules are fairly straightforward:
1) If you select as Source Attribute an attribute that has an associated identifier (such as an Entity Id when the Source Attribute is also from an Entity), that Id will be picked (but unfortunately not shown, a bit of a missing feature imho). The Variable must be of type Identifier of X, where X is the Entity.
2) If you select as Source Attribute an attribute without an associated identifier, you must select one of the available attributes. Your Variable must have the same type as that attribute (or of a type which the type of the attribute can be converted to).
In the above example, User.Name is the Source Attribute, so User.Id is the associated Id. The Variable must therefore be a User Identifier (which it is).

Then there's the Special List. In the Special List you can specify combo box values that are displayed above the values from the Source List, in the order you specify them. "Value" is the identifier value, "Option" the option shown in the combo box (so comparable to the "Source Attribute" property). Note that if the user selectes a value from the Special List, the Variable will not receive that value. Instead it will be empty (NullIdentifier(), NullTextIdentifier, "", 0 etc.). If you want to capture the Value of the special list, you need to specify a Special Variable. The Special Variable is always of type Text (so it follows that the Value you specify is also Text, which explains why you needn't specify quotes: in the example above, the first Value is the Text "0"). Note that if the user does not select something from the Special List, the Special Variable is empty (i.e. "").

Good, that's the basics. Now onto what the platform displays and returns. When the combo box is rendered (i.e. after the Preparation has run when the page is loaded, or after an Ajax Refresh is performed), it checks the values of the Variable and Special Variable, in that order:
1) If the Variable has a valid value (i.e. it has a value that's part of the Source List), that item is selected (i.e. that's what the user sees in the combo box). The value of the Special Variable is ignored, and the Special Variable is cleared (i.e. set to "").
2) If the Variable is empty (e.g. NullIdentifier()) or doesn't have a valid value, and no Special Variable is specified, the combo box shows the first item from the Special List. This also goes if a Special Variable is specified but it's empty.
3) If the Variable is empty or doesn't have a valid value, and the Special Variable is specified and has a valid value (i.e. one of the items from the Special List has a matching value), that item is selected.

When the user selects an item from the combo box, it depends on the type of item what the platform does:
1) If the user selects an item from the Special List, the platform assigns the Value from that item to the Special Variable (if specified), and clears the Variable.
2) If the user selects an item from the Source List, the platform assigns the value of the Source Identifier Attribute to the Variable, and clears the Special Variable (if specified).

I think that with the above information, you should be able to fix your problem. If not, well, like I said, I'm not the person that can help you.
I said that in my answer...
But maybe we are not to understand the eric question.
Or perhaps we do, but eric doesn't understand our answers :)
Hi,

Really sorry for that, I didn`t explain it clearly.
I used the record list as the variable of the combo box. And I have loop over the list in the perparation.
So, the CurrentRowNumber of the list became the last record number of the list.
So, when I open the webpage, the combo box default choice the last record of the list. But I think the default choice should be the first one.
I guess I can make it by set currentRowNumber to 0, but I don`t know to do it.
Sorry again for didn`t put it clearly, and we didn`t talk the same question before.

Like below, when I open the combo box, it default choose the last record(the highlight record,it`s the last record in the list). It should be the first record.
When I open the page,the defaultly give me the last record and submitted it. Also, when I open the combo box,
the pointer pointed the last record in the list.
Actually, I just want the pointer point the first record, and defautly submit the first record.
Since I have for each loop op in the perparation, so the currentRowNumber is no longer 0, I thought this will
effort the list in the combo box. So the pointer defaultly point to the last record in the list, I think it`s odd for user.
Usually, we defaultly choose the first record in the combo box.
I don`t know am I clear this time.
Sorry for the mislead before.
I know the meaning of your answer. But we didn`t discuss the same issue.
You're perfectly clear, and like I said, it's perfectly clear to me you haven't even read what I posted. You say "So, the CurrentRowNumber of the list became the last record number of the list.", but this is patently false. As I wrote above, and as you didn't read, the combo box displays whatever record is associated with the value of its Variable. It has NOTHING TO DO AT ALL with the fact you iterated over the list, unless you did something like use the Current of the record list as the variable of the combo box, which you really, really, really shouldn't do (and if you wonder why not, again, read my post).
Kilian Hekhuis wrote:
You're perfectly clear, and like I said, it's perfectly clear to me you haven't even read what I posted. You say "So, the CurrentRowNumber of the list became the last record number of the list.", but this is patently false. As I wrote above, and as you didn't read, the combo box displays whatever record is associated with the value of its Variable. It has NOTHING TO DO AT ALL with the fact you iterated over the list, unless you did something like use the Current of the record list as the variable of the combo box, which you really, really, really shouldn't do (and if you wonder why not, again, read my post).
 Hi Kilian,

  Really sorry for it. And thanks a lot for the reply. I have fixed the issue.
Since I have used the record list as the data source of the combo box, and I have loop over it.
So the combo box by default choose the last record.
I have used a null for each loop to fix the issue. I added another for each loop on the record list, and it`s from 0 to 0. So the op will reset the id of the list. Then problem fixed.
 
eric,

I'm sorry, but you haven't fixed it. You did something that apparently fixed your issue, but there's nevertheless something seriously wrong if you believe you need a "null for each loop" for something so simple as what you are doing. Sometimes I wonder why I bother....