Setting a default value for a Select no longer works

This is something that used to work but no longer does.

Lets say table ‘products’ has 5 values with ID & Description
1 - Book
2 - Pen
3 - Pencil
4 - Paper
5 - Eraser

Create a new Search application.
Use the ID field as a ‘Select’ field with Automatic lookup, something like
SELECT ID, Description
FROM tbl_products
ORDER BY Description

I would like to set an initial default for this Select field.
IE, I want to default the dropdown to the value of “4”, which should show Paper in the dropdown.

In OnScriptInit, add code
{ID}=4;

In previous versions of scriptcase, this would work and when entering the Search page, the dropdown would be set to the default value. Now in my 9.10.0010 version, this no longer works.

I had upgraded to 9.10 from 9.6 last year when this was working fine. My customers are complaining and I have no solution for them to make this work again.

I reproduced the issue in a scriptcase samples database using tbl_assets

You can do it this way:
image

I don’t see this option in the Fields for a Search application or a search within a grid.

Dear @gregsintx,

As you want to start the field set to a fixed value, you can use the “Default value” option that is present in the “Search Lookup” block of the field in question, as you can see in the example in the image below.

default_value_search

We hope this can help you with what you want.

Best regards!

Thanks for the input, however the default value will not be a fixed value. It will be coming from a query I execute on another record and then populate a global variable.
I had tried this specifying a global variable and it does not seem to work.
Let me know if there is some trick to this.

You can use a global variable like [my_var]

1 Like

You would think that should work but it doesn’t.

I tested and the event works fine:
image

Thanks alvagar - can you do a favor and set to another value and verify that? The Select always defaults to the first value alphabetically and I dont know your data, but it does start with “A”. Also what version are you on? As I mentioned this was working fine for me, but now on the 9.10.0010 it is no longer working so not sure what is up.

My version SC: 9.10.014

1 Like

Interesting, I am going to try to update my version to 9.10.0014 to see if this helps!

1 Like

Dear @gregsintx,

Let us know if after upgrading to the latest version of Scriptcase (9.10.014), the issue you reported has been fixed.

Best regards!

1 Like

Sorry meant to follow up on this.
For me, it still does not work as expected after upgrading to the most recent version.
I am happy to record a video or provide some project to show what I am seeing.