- This topic has 4 replies, 2 voices, and was last updated 10 years ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- You must be logged in to reply to this topic.
Integrated Application Platform
Integrated Application Platform › Forums › General › ChooseList not "set"ting
Hi,
I have a field sT_Type in the table StkTrades with the following field definition
Field_string
{
Prompt: "Trade Type"
Control: #(ChooseList list: #('Long','Short'), set: 'Long' )
}
When I open the table using AccessControl(‘StkTrades’), the field value is not set to Long.
However, if, from WorkSpace, I run the code
ChooseListControl( list: #('Long','Short') , set: 'Long' )
the value is set.
Similarly, the selectFirst: true is also not setting the value from inside Access.
What is wrong?
Thanks in advance,
ajith
I think probably AccessControl is setting the control from the data. On a new record, the data will be “”.
One way to get a default in an Access is to rename the field (in the query) e.g. to sT_Type_default and then to create Rule_sT_Type_default which is simply function () { return ‘Long’ }
(It is possible to put the rule on the actual field name, but this can be confusing so it is better to rename.)
Hi Andrew,
Thanks for the reply. I have left out the set: option and is using a rule to provide the default value. However, I am not renaming the field as you have suggested. I did not understand why it can be confusing to put the rule on the original field name (especiually if set: option is left out).
ajith
If the rule is on the actual field, then it will always be applied. For example, if you look at the table in QueryView you will not be able to see if the field is empty or not because the rule will always show a value.
Hello Andrew,
Thanks for clarifying
ajith