Lookup Field

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Lookup Field

Post by angus » 2022-08-03 14:32

Hi everyone, I updated the Advanced option in the lookup field so that I only select records after a certain date. This all works ok.

The issue I have though is that the search box no longer works - only happened after I updated the Advanced box.

When I restore the default the search box works again.

I am using 5.82.

does anyone know this issue and how to fix it?
AppGini 22.13

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Lookup Field

Post by jsetzer » 2022-08-03 14:42

Maybe an error in your customized SQL command. Can you post it here?
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Re: Lookup Field

Post by angus » 2022-08-03 20:45

thanks Jan, the code is from the ajax_combo.php (I entered this in the Advanced field in the appgini tool)

Code: Select all

'member' => array(
				'parent_table' => 'old_member',
				'parent_pk_field' => 'wbsid',
				'parent_caption' => '`old_member`.`member`',
				'parent_from' => '`old_member` ',
				'filterers' => array(),
/*				'custom_query' => '',*/
				'custom_query' => 'SELECT `old_member`.`wbsid`, `old_member`.`member` 
								   FROM `old_member` 
								   where str_to_date(monthValidTo, \'%d/%m/%Y\') > CURDATE()
								   ORDER BY 2',
				'inherit_permissions' => false,
				'list_type' => 0,
				'not_null' => true
AppGini 22.13

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Lookup Field

Post by jsetzer » 2022-08-03 21:19

Maybe I did not understand. I understood lookup does NOT work when you disable default query in advanced lookup settings and enter a custom sql query. The custom query should be a SQL command, not a php array as given in your last post.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Re: Lookup Field

Post by angus » 2022-08-04 00:06

I input into the advanced field on the Lookup Field tab. This then outputs the code above into the ajax_combo.php field I think Jan
appgini_lookup_field2.png
appgini_lookup_field2.png (88.16 KiB) Viewed 1648 times
The image is where I enter the query. I did a test and removed it, and search worked OK, when I added the query again, the search does not work
AppGini 22.13

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Lookup Field

Post by jsetzer » 2022-08-04 04:27

For narrowing down, take that SQL command and run it in your SQL tool (for example adminer or phpMyAdmin). See if it works at all.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Re: Lookup Field

Post by angus » 2022-08-04 09:30

Yes, works perfect
AppGini 22.13

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Lookup Field

Post by jsetzer » 2022-08-04 11:36

Next step could be watching the network traffic between browser and server in browser's development tooks when fetching records on opening dropdown. What is the server response?
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Re: Lookup Field

Post by angus » 2022-08-05 14:20

sorry Jan, not sure how I do this?
AppGini 22.13

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Lookup Field

Post by jsetzer » 2022-08-05 14:27

- F12
- Open network tab
- Click lookup arrow button and watch out for the ajax_combo.php call, listed in network tab
(You can even filter on ajax_combo)
- select the entry and check payload and response

There may be an error or there may be an empty result. Can you post some relevant screenshots of the network tab and also check if there are errors in console tab.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Re: Lookup Field

Post by angus » 2022-08-07 16:40

Jan, had a go at this but could not see any lookup arrow button
screenshot_appgini.png
screenshot_appgini.png (71.44 KiB) Viewed 1499 times
AppGini 22.13

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Lookup Field

Post by jsetzer » 2022-08-07 17:19

but could not see any lookup arrow button
Sorry, I meant the button in DV which opens the select list of the lookup field you are referring to.

In other words: open the lookup by clicking it. This should force the client to request available lookup-entries from the server. You will see the network request on click immediately. When selecting that request in network tab, you can see the payload (data sent to server by client) and response (data the client received from server).

Screenshots of request and respond would help if there is a problem.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

Post Reply