variables in edition lookup

Hi…

I’m trying to use variables in edition lookup in the title and the title initial value…

The title works fine but in the initial value it does not work…

any ideas or similar experience ???

gracias…tnx… Florus

Re: variables in edition lookup

Not sure what you mean…

To set a default value AAA for a field:

Tab “GENERAL SETTINGS: STATUS”:
Initial Value (type): defined
Initial Value: AAA

To set a title for the field (like “choose one”):

Tab “EDITION LOOKUP”:
Use title: yes
Title: choose one
Title internal value: BBB

Title internal value sets a “hidden” value for the field when the user selects the title value, in this case “choose one”. When you insert the record while the value on the screen is “choose one”, then in de database value “BBB” is inserted. You can make BBB visible immediately by checking “Reload form when value has changed”.

code generated for title:
<option value=“BBB”>choose one</option>

Re: variables in edition lookup

[user_name] = florus
[user_id] = 1

Tab “EDITION LOOKUP”:
Use title: yes
Title: [user_name]]
Title internal value: [user_id]

The idea is that the current user is set default but he is able to choose an other user here…
i want to display the name [user_name] but the value that must be updated in the database is the [user_id]… so this must be the internal value…

the program displays the [user_name] correct… but gives an error upon updating the row…

it tries to insert the value “[user_id]” into the database instead of the value of the variable

Re: variables in edition lookup

probably a bug or a “feature”. Try contacting support, maybe there’s a bugfix coming up or a workaround.

Re: variables in edition lookup

Hi there,

let me play reactivate this thread.
I have a combobox, which shows country names.
The table that is edited by my form only stores country codes (‘GB’, ‘F’, ‘G’, etc.).
So I have a SELECT statement declared for that combobox:

SELECT country_code, country_name FROM Table_Country

That works fine, so far.
Now I want the form to show an initial value like ‘<Select Country>’.
Of course that initial value has no record in the DB; the user shall be forced to select a value from the combobox.
Setting “Use title” to ‘yes’ and “title” to ‘<Select Country>’ does not work.

Can you please help me?

Re: variables in edition lookup

Just remove the “<” and “>” from <Select Country>

This is a bug or undocumented feature, whatever you want…

Re: variables in edition lookup

Okay, thanks!
Is there a possibility to force the user to make a selection?
In order not to let him forget to choose a country?
If I just set the column to “not null” in the DB, there’ll be an ugly error presented to the user insted of a nicer warning message.

In fact, there is the possibility to set “display message” to yes at required fields.
This works works for other fields, but not for the field where I have “Select country” as initial value.
It seems as if Script case accepts this initial value for the required field and tries to execute the INSERT-Statement. The DB itself then throws an error message:

Column country cannot be null

Any idea on how to avoid this?

Re: variables in edition lookup

How about making the field required in the form?

Re: variables in edition lookup

Yes, that’s what I meant and did by the above description.

But I did figure it out:
I set ‘Use title’->‘Yes’; ‘Title’ -> “< Country >” and internal value to “null” (which I saw somewhere in the documentation).
In fact, “null” was obviously not recognized as null. I just had to leave this empty.
BTW: ‘Title’ -> “< Country >” does work, as long as you put blanks between ‘<’ and ‘>’.

Thanks for the help!

This is my second day with Script Case; slowly I am making progress! :slight_smile: