Title: Lookup value incorrect when using View
Last modified: August 31, 2019

---

# Lookup value incorrect when using View

 *  Resolved [wpsd2006](https://wordpress.org/support/users/wpsd2006/)
 * (@wpsd2006)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/lookup-value-incorrect-when-using-view/)
 * Hi I put as a new post here.
 * Is it possible to lookup from “view” table ?
    I have this one view that combine
   multiple table to easy access. But when lookup this table it confuse the form,
   some value are not shown and when added it select the wrong ID.
 * This is the table
    wp_users ( default wp table, change it to innodb ) customer,**
   column** : user_id (FK), customer_id (PK) customer_contract , **column** : customer_id(
   FK), contract_id (PK), contract_info, etc
 * The relation is ( Foreign Key )
    wp_users.ID = customer.user_id customer.customer_id
   = customer_contract.customer_id
 * Then I create a view for this three table which will shown
    wp_users.ID wp_users.
   display_name customer.customer_id customer_contract.contract_id Note than since
   one user can have multiple contract, there will be duplicate ID. Does this cause
   the problem ?
 * In the customer_contract table that generated by wp data access, I set it to 
   lookup above **view** by their contract_id to find the display_name. But it get
   mess up, some user display_name were shown some not ( showing a different column
   value ).
 * Then when I add new contract to the customer, it save with the wrong customer_id

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Thread Starter [wpsd2006](https://wordpress.org/support/users/wpsd2006/)
 * (@wpsd2006)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/lookup-value-incorrect-when-using-view/#post-11885412)
 * Yeah I notice that the duplicate record cause lookup to mess up.
    I try creating
   new view that only connect wpch_users and customer table, It looks ok now.
 *  Plugin Author [Passionate Programmer Peter](https://wordpress.org/support/users/peterschulznl/)
 * (@peterschulznl)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/lookup-value-incorrect-when-using-view/#post-11885821)
 * Hi,
 * Have you got it working?
 * To answer your question (Is it possible to lookup from “view” table ?) in general:
   
   Yes, you can add a lookup to a view. This solution however has an important limitation.
   Since views do not have primary or unique keys you will not be able to show the
   data entry form for the rows in your view. As a result this solution can only
   be used to create a list table.
 * Did I answer your question? Please let me know if you need more help.
 * Best regards,
    Peter
 *  Thread Starter [wpsd2006](https://wordpress.org/support/users/wpsd2006/)
 * (@wpsd2006)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/lookup-value-incorrect-when-using-view/#post-11889053)
 * Ok, I’ll try again. I think as long as the view doesn’t have multiple value for
   one primary key it’s ok for entry lookup.
 * I have more question, a bit unrelated.
    **1. Is it possible in parent/child type
   to disable edit mode, but in the child I enable the edit mode**
 * Table 1 – Type: parent/child, Mode: View, Allow Insert : No, Allow Delete : No
   
   Table 2 – Type: table, Mode: Edit, Allow Insert : Yes, Allow Delete Yes
 * I want to edit only table2 that has relation to table1, but disable editing mode
   for table 1 ( prevent unnecessary editing )
 * **2. What is “Less ?” means in “Manage columns for data entry” option in “Manage
   Table Options” Tab ?**
 * **3. Got a ERROR: Wrong arguments [missing primary key value] when adding new
   entry**
 * I read on one of the article in the support that I need to update from bitbucket
   repo, Is this true ?
 * **4. Cannot remove pages from projects**
    I cannot remove page from project even
   If it doesn’t have any relationship (static ) Have to remove it from database
   manually, any effect by doing this ?
    -  This reply was modified 6 years, 9 months ago by [wpsd2006](https://wordpress.org/support/users/wpsd2006/).
 *  Plugin Author [Passionate Programmer Peter](https://wordpress.org/support/users/peterschulznl/)
 * (@peterschulznl)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/lookup-value-incorrect-when-using-view/#post-11891593)
 * Hi,
 * Let me try to answer your question…
 * >>> I think as long as the view doesn’t have multiple value for one primary key
   it’s ok for entry lookup.
    You can add a lookup for a table or view with multiple
   column keys as well. Directly behind field “Source column name” there is a plus
   icon. If you click on that icon you can add a relationship with multiple columns.
 * Q1) This is not possible at this time. But I added it to my to do list! 🙂 Great
   idea!
 * Q2) If you have a parent with a lot of columns you can uncheck the less option
   for parent columns you don’t want to be shown by default. If at least one column
   is unchecked a button is generated for the parent that allows you to switch between
   less and more mode. Please check out the video in the online help on this topic:
   Data Projects – Video Tutorials > (4) Data Projects add a less/more button to
   your parent-child forms.
 * Q3) You can download from Bitbucket for your own development but please don’t
   use a Bitbucket version in production. Bitbucket is work in progress and you 
   might run into other (bigger) problems. You can download a pre-release from the
   current development that should be stable and solves this issue from here:
    [https://drive.google.com/file/d/177IVh4U8zlbcdWFPR-oUaU-gfO5XYCs0/view?usp=sharing](https://drive.google.com/file/d/177IVh4U8zlbcdWFPR-oUaU-gfO5XYCs0/view?usp=sharing)
 * Q4) You can safely delete a project page from the Data Explorer. I was able to
   reproduce this error on my computer, so I added this issue to my to do list and
   will fix it in the next release. Thanks for bringing this issue up! 😉
 * Hope this helps! Great to see you’re working with the plugin. 🙂
 * Best regards,
    Peter
 *  Thread Starter [wpsd2006](https://wordpress.org/support/users/wpsd2006/)
 * (@wpsd2006)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/lookup-value-incorrect-when-using-view/#post-11892242)
 * Hi thank you for the reply
 * > >>> I think as long as the view doesn’t have multiple value for one primary
   > key it’s ok for entry lookup.
   >  You can add a lookup for a table or view with
   > multiple column keys as well. Directly behind field “Source column name” there
   > is a plus icon. If you click on that icon you can add a relationship with multiple
   > columns.
 * Still confuse with the logic behind n:m, I’ll further test it.
 * > Q1) This is not possible at this time. But I added it to my to do list! 🙂 
   > Great idea!
 * Great, thanks. It’s ok If I the only one use it, but if other people I have to
   give a little bit of restriction 😀
 * > Q2) If you have a parent with a lot of columns you can uncheck the less option
   > for parent columns you don’t want to be shown by default. If at least one column
   > is unchecked a button is generated for the parent that allows you to switch
   > between less and more mode. Please check out the video in the online help on
   > this topic: Data Projects – Video Tutorials > (4) Data Projects add a less/
   > more button to your parent-child forms.
 * Lol – sorry for the stupid question, I just notice it.
 * > Q3) You can download from Bitbucket for your own development but please don’t
   > use a Bitbucket version in production. Bitbucket is work in progress and you
   > might run into other (bigger) problems. You can download a pre-release from
   > the current development that should be stable and solves this issue from here:
   > 
   > [https://drive.google.com/file/d/177IVh4U8zlbcdWFPR-oUaU-gfO5XYCs0/view?usp=sharing](https://drive.google.com/file/d/177IVh4U8zlbcdWFPR-oUaU-gfO5XYCs0/view?usp=sharing)
 * There is a problem I face now, I need to fill the whole column even if it is 
   allow to be null in the table when adding entry. After successfully adding it
   then it cannot be remove.
 * I think this was ask by other ticket, maybe add a “debug mode” so when there 
   is an error you print the sql query that cause the error. I know we can check
   from sql log, but it is a bit difficult to see that in share hosting.
 * This way we can track better what we do wrong in the settings.
 * > Q4) You can safely delete a project page from the Data Explorer. I was able
   > to reproduce this error on my computer, so I added this issue to my to do list
   > and will fix it in the next release. Thanks for bringing this issue up! 😉
 * Awaiting for next release
    -  This reply was modified 6 years, 9 months ago by [wpsd2006](https://wordpress.org/support/users/wpsd2006/).
 *  Thread Starter [wpsd2006](https://wordpress.org/support/users/wpsd2006/)
 * (@wpsd2006)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/lookup-value-incorrect-when-using-view/#post-11892247)
 * This error not quiet helping :D, I’m using administrator role.
 * > ERROR: Not authorized [delete not allowed]
   > The message above was triggered by wp-data-access.
   > Call stack:
   >  do_action(‘toplevel_page_wpdp_4_8’)
   >  wp-admin/admin.php:253 WPDataProjects\
   > WPDP->manage_project_page() wp-includes/class-wp-hook.php:286 WPDataProjects\
   > P\WPDP_Parent_List_View->show() wp-content/plugins/wp-data-access/WPDataProjects/
   > WPDP.php:401 WPDataProjects\P\WPDP_Parent_List_View->display_edit_form() wp-
   > content/plugins/wp-data-access/WPDataProjects/Parent_Child/WPDP_Parent_List_View.
   > php:170 WPDataProjects\P\WPDP_Parent_Form->show() wp-content/plugins/wp-data-
   > access/WPDataProjects/Parent_Child/WPDP_Parent_List_View.php:215 WPDataProjects\
   > P\WPDP_Parent_Form->show_child_list_table() wp-content/plugins/wp-data-access/
   > WPDataProjects/Parent_Child/WPDP_Parent_Form.php:272 WPDataAccess\L\WPDA_List_Table-
   > >show() wp-content/plugins/wp-data-access/WPDataProjects/Parent_Child/WPDP_Parent_Form.
   > php:337 WPDataAccess\L\WPDA_List_Table->prepare_items() wp-content/plugins/
   > wp-data-access/WPDataAccess/List_Table/WPDA_List_Table.php:938 WPDataAccess\
   > L\WPDA_List_Table->process_bulk_action() wp-content/plugins/wp-data-access/
   > WPDataAccess/List_Table/WPDA_List_Table.php:1129 wp_die() wp-content/plugins/
   > wp-data-access/WPDataAccess/List_Table/WPDA_List_Table.php:1239
 *  Thread Starter [wpsd2006](https://wordpress.org/support/users/wpsd2006/)
 * (@wpsd2006)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/lookup-value-incorrect-when-using-view/#post-11892289)
 * One more feature need to allow negative sign on numeric entry
 *  Plugin Author [Passionate Programmer Peter](https://wordpress.org/support/users/peterschulznl/)
 * (@peterschulznl)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/lookup-value-incorrect-when-using-view/#post-11892988)
 * >>> One more feature need to allow negative sign on numeric entry
 * Funny that no one ever asked for this… 😉 It’s on my to do list now!
 * >>> This error not quiet helping :D, I’m using administrator role.
 * This is fixed in the next release.
 * >>> I think this was ask by other ticket, maybe add a “debug mode” so when there
   is an error you print the sql query that cause the error. I know we can check
   from sql log, but it is a bit difficult to see that in share hosting.
 * If you navigate to Manage Plugin (Back-end Settings) and scroll down you’ll see
   a checkbox that allows you to enable debug mode. There is not much debugging 
   right now, but maybe this helps. Let me know if you have suggestions…
 * Thank you for all your valuable feedback!!! 🙂
 * Best regards,
    Peter
 *  Plugin Author [Passionate Programmer Peter](https://wordpress.org/support/users/peterschulznl/)
 * (@peterschulznl)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/lookup-value-incorrect-when-using-view/#post-11947445)
 * Hi wpsd2006,
 * Just to let you know, I released a new version yesterday which supports negative
   numeric values. Thank you for bringing up this issue!
 * Best regards,
    Peter

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Lookup value incorrect when using View’ is closed to new replies.

 * ![](https://ps.w.org/wp-data-access/assets/icon-256x256.png?rev=3299063)
 * [WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards](https://wordpress.org/plugins/wp-data-access/)
 * [Support Threads](https://wordpress.org/support/plugin/wp-data-access/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-data-access/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-data-access/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-data-access/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [Passionate Programmer Peter](https://wordpress.org/support/users/peterschulznl/)
 * Last activity: [6 years, 8 months ago](https://wordpress.org/support/topic/lookup-value-incorrect-when-using-view/#post-11947445)
 * Status: resolved