Default value Lookup-Field

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
User avatar
RonP
Veteran Member
Posts: 219
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Default value Lookup-Field

Post by RonP » 2022-06-17 16:12

Hi,
I have made for some fields Lookups.
For the specific field I've set the default value as "1" (the first record in the related table)

After generating the project and open the project in the browser and "Add " a new record I assumed to see the value of the first record from the related table.
However I see the text : No matches found
What do I do wrong?
Ron
Attachments
Lookup-default.JPG
Lookup-default.JPG (48.39 KiB) Viewed 2833 times
Default_for_field_coach2.JPG
Default_for_field_coach2.JPG (98.97 KiB) Viewed 2833 times
Default_for_field_status1.JPG
Default_for_field_status1.JPG (70.76 KiB) Viewed 2833 times

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Default value Lookup-Field

Post by pbottcher » 2022-06-19 07:58

Hi Ron,

are you sure you have the PK = 1 in the lookup tables (status and coach) set?
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
RonP
Veteran Member
Posts: 219
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Re: Default value Lookup-Field

Post by RonP » 2022-06-19 08:56

Hi,
Thank you for looking into my "Problem"
As you can see, attachments, I think I do the right things to get a "default" value whenever a new "Aanvragen-record" is made.
Ron
Attachments
Table_Coach.JPG
Table_Coach.JPG (160.68 KiB) Viewed 2795 times
Lookup_coach.JPG
Lookup_coach.JPG (130.78 KiB) Viewed 2795 times

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Default value Lookup-Field

Post by pbottcher » 2022-06-19 09:39

Hi Ron,

yes, but can you please check in your database if you have the record with the id=1 in the coach table available.

Code: Select all

select  min(id) from coach 
shall return 1, if not it will give you the number you need to put into the aanvragen.Coach1_ID default setting.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
RonP
Veteran Member
Posts: 219
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Re: Default value Lookup-Field

Post by RonP » 2022-06-19 13:25

According to me it is all Okay, however now default shows up at a new record "aanvragen"
Ron
Attachments
All_rows_Tabel_Coach.JPG
All_rows_Tabel_Coach.JPG (60.64 KiB) Viewed 2776 times
Select min(id).JPG
Select min(id).JPG (34.8 KiB) Viewed 2776 times

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Default value Lookup-Field

Post by pbottcher » 2022-06-19 16:56

So all is good now, or is anything open?
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
RonP
Veteran Member
Posts: 219
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Re: Default value Lookup-Field

Post by RonP » 2022-06-19 17:31

Sorry,
Same result as when I started this Post.
Adding a record the Picklist fields stil say:

no matches found

Ron

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Default value Lookup-Field

Post by pbottcher » 2022-06-19 20:05

which version are you on?
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
RonP
Veteran Member
Posts: 219
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Re: Default value Lookup-Field

Post by RonP » 2022-06-19 20:12

Version 22.14.
Problem occured also at 22.13

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Default value Lookup-Field

Post by pbottcher » 2022-06-20 17:43

Hi Ron,

after looking deeper into this I think you need to specify the actual value including the separator of the lookup table (voornaam - achternaam), not the PK.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
RonP
Veteran Member
Posts: 219
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Re: Default value Lookup-Field

Post by RonP » 2022-06-20 18:16

Now I lost you.
In the lookup query I did specify Voornaam and Achternaam.
This value is to be seen whenever you click the picklist of the specified field.

I think that it is not possible to have the default value in, set in the database by .Id field ( in this case value 1) when one creates a new record.
.

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Default value Lookup-Field

Post by pbottcher » 2022-06-20 19:31

sorry for not making this clear.

Put in the default value the display string of what you would select from the picklist. One comment, as shown in you extract the selection should be unique othewise it might be confusing.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
RonP
Veteran Member
Posts: 219
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Re: Default value Lookup-Field

Post by RonP » 2022-06-21 14:52

Okay,
I still don't get it.
I've now made a variation of Look-up presentations.
In case of picklist "Coach-" It could be a long list displayed as a radio-button.
So therefore I would like to see, if possible text like "<pick one>" That should be p.a. ID number 1 in the table coches.
If I give the fields "Coaches-" an initial value of 1 (defined in the AppGini application and in the database table) nothing shows up by creation of a new record.

If I give the value "<pick one>" in both the table and AppGini field I get an error in the table, because the Coach_Id in the table "Aanvragen" is defined as an Integer.

I hope I can make my point clear, don't bother that much I'll the go on with the Picklist option that suits.
Ron
Attachments
Varius-Lookup.JPG
Varius-Lookup.JPG (60.42 KiB) Viewed 2665 times

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Default value Lookup-Field

Post by pbottcher » 2022-06-22 20:33

Hi,

so if I look at you list of Coaches, you may add

Mary-Doe

into the default setting of the aanvragen.Coach1_ID field.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
RonP
Veteran Member
Posts: 219
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Re: Default value Lookup-Field

Post by RonP » 2022-06-23 15:05

Hi,
I think we are still, I mean me, out off sync.
I like to see that, in this case, the value "Test voor enkele aanvraag"already is displayed in the fieldname.
Do you think this Is that possible?
ron

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Default value Lookup-Field

Post by pbottcher » 2022-06-23 19:03

Hi Ron,

it should work.
In case of

Test voor enkele aanvraag

it shoudd be

test-voor Enkele aanvraag

where test is the firstname and voor Enkele aanvraag the lastname.

You can use the combination in the default value that you put in the lookup, but rther the PK of the lookup table you need to put the result of the lookup in the defaut value.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
RonP
Veteran Member
Posts: 219
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Re: Default value Lookup-Field

Post by RonP » 2022-07-04 10:37

Hi,
I've done your suggestions, however .... no results.
Is there a "bug" in this release or.... Is it not possible want I want?
(After this try (see screenshots) I've place the defaultvalue back to 1 at field Coach-1)

I use: Version 22.14; Revision 1293
Ron
Attachments
Lookup-default-02.JPG
Lookup-default-02.JPG (157.17 KiB) Viewed 2518 times
No-default-to-be-filled-out.JPG
No-default-to-be-filled-out.JPG (39.63 KiB) Viewed 2518 times

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Default value Lookup-Field

Post by pbottcher » 2022-07-05 05:44

Hi Ron,

if I see it correctly in the screenshot, you have spaces in the default value. Try

test-voor Enkele aanvraag

instead of

test - voor Enkele aanvraag

It needs to be the exact text that appears in the dropdown.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
RonP
Veteran Member
Posts: 219
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Re: Default value Lookup-Field

Post by RonP » 2022-07-05 12:55

Hi pböttcher
I'm a happy camper :D
It listens very careful as I now understand
Thank you being so patient with ne, great!
Ron

Post Reply