Lookup Field vs What's Shown in Table View
Posted: 2016-04-18 03:56
All,
I've always had this odd problem that I've never thought about too much, but I'm creating a new version of my app and I'd like to fix it.
I have custom lookup code in some tables to select a Person's ID, title (Mr, Mrs, etc), Forename, Surname;
SELECT `ContentItem_Persons`.`id`, IF(CHAR_LENGTH(`ContentItem_Persons`.`forename`) || CHAR_LENGTH(`ContentItem_Persons`.`surname`) || CHAR_LENGTH(`ContentItem_Persons`.`title`), CONCAT_WS('', `ContentItem_Persons`.`id`, ' - ', `ContentItem_Persons`.`title`, ' ', `ContentItem_Persons`.`forename`, ' ', `ContentItem_Persons`.`surname`), '') FROM `ContentItem_Persons` ORDER BY `ContentItem_Persons`.`id` ASC
So the lookup value looks like;
That's cool. Exactly how I want it.
I also set the Lookup Parent Caption fields as follows;
The two issues I'm having are
1 - Searching the lookups. When I drop down the lookup and start typing to search through the values I can only search for the forename and surname fields. If I search for the ID, or title, it returns no results;
Why is that?
2 - In the Table view, the value of the lookup column is displayed as "forename surname" - how do I get it to display "ID, title, forename, surname", the same format as the lookup? I guess I have to edit the template code manually, which is a pain.
Thanks for your help and comments!
A.
I've always had this odd problem that I've never thought about too much, but I'm creating a new version of my app and I'd like to fix it.
I have custom lookup code in some tables to select a Person's ID, title (Mr, Mrs, etc), Forename, Surname;
SELECT `ContentItem_Persons`.`id`, IF(CHAR_LENGTH(`ContentItem_Persons`.`forename`) || CHAR_LENGTH(`ContentItem_Persons`.`surname`) || CHAR_LENGTH(`ContentItem_Persons`.`title`), CONCAT_WS('', `ContentItem_Persons`.`id`, ' - ', `ContentItem_Persons`.`title`, ' ', `ContentItem_Persons`.`forename`, ' ', `ContentItem_Persons`.`surname`), '') FROM `ContentItem_Persons` ORDER BY `ContentItem_Persons`.`id` ASC
So the lookup value looks like;
That's cool. Exactly how I want it.
I also set the Lookup Parent Caption fields as follows;
The two issues I'm having are
1 - Searching the lookups. When I drop down the lookup and start typing to search through the values I can only search for the forename and surname fields. If I search for the ID, or title, it returns no results;
Why is that?
2 - In the Table view, the value of the lookup column is displayed as "forename surname" - how do I get it to display "ID, title, forename, surname", the same format as the lookup? I guess I have to edit the template code manually, which is a pain.
Thanks for your help and comments!
A.