Search Crashes when searching Views using global-search.php

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
mohamed
Veteran Member
Posts: 80
Joined: 2020-04-19 16:18

Search Crashes when searching Views using global-search.php

Post by mohamed » 2020-10-30 05:49

Hello,

I am using Global-Search.php from https://gist.github.com/bigprof/1dc6bc2 ... c48c2a4cc7
The problem, it crashes when searching a VIEW table

The error:

unknown column 'View_ADSL.' in 'field list'

Query:
SELECT `View_ADSL`.`` as 'PRIMARY_KEY_VALUE', `View_ADSL`.`id` as 'id', `View_ADSL`.`Site` as 'Site', .....



** I am creating VIEWs as follows:
1. Create VIEW in MySQL
2. Create a Table in AppGini with same name and fields details



**
1. Am I using VIEWs with AppGini in the correct way ?

2. Any clue about such crash ?
THANK YOU...
AppGini Pro 24.11 -
Calendar - Search Page Maker - Summary Reports - Mass Update - DataTalk -
bizzworxx AppGini Helper JabaScript Library - bizzworxx Inline Detail-View - bizzworxx Helper Pack - AppGini Helper Packaging Tool -
Udemy course

pfrumkin
Veteran Member
Posts: 157
Joined: 2020-02-18 17:58
Location: Albuquerque, New Mexico USA

Re: Search Crashes when searching Views using global-search.php

Post by pfrumkin » 2020-10-30 16:45

To create a view I have done the following:
1) Create the table in my AG project, generate
2) Drop table in SQL
3) Create view in SQL

When adding/removing columns, you have to drop the view, then generate the site, allowi the automation to recreate the table, then drop the table and create the view.

I have found it a little klunky that we have to drop the view when changing the original table schema but I see why. Creating the view this way is a little kludgy to begin with. That would be a nice feature to add in AG, but I can see it's fraught with complications.

mohamed
Veteran Member
Posts: 80
Joined: 2020-04-19 16:18

Re: Search Crashes when searching Views using global-search.php

Post by mohamed » 2020-10-31 10:01

Hi pfrumkin,

Actually, I was trying to use the view by hiding the original table from an end user.
BUT
I am not sure if I can hide original tables in Global Search, i.e., the end user can only Search the View that he has rights to view !
THANK YOU...
AppGini Pro 24.11 -
Calendar - Search Page Maker - Summary Reports - Mass Update - DataTalk -
bizzworxx AppGini Helper JabaScript Library - bizzworxx Inline Detail-View - bizzworxx Helper Pack - AppGini Helper Packaging Tool -
Udemy course

pfrumkin
Veteran Member
Posts: 157
Joined: 2020-02-18 17:58
Location: Albuquerque, New Mexico USA

Re: Search Crashes when searching Views using global-search.php

Post by pfrumkin » 2020-11-01 19:07

I had not considered that as a problem but perhaps it is. The rights to the view in AG are simply the rights to the (view) table on which it is based - AG doesn't know it's a view, thinks it's the original table. But I see your point, SQL may impose it's own access control on the view based on the tables that define the view. It seems that should be a power of SQL views, to provide access to data in a view of tables that they otherwise would not have access. And I think AG does manage all the access at the AG table level, not internally in SQL.

All that said I haven't tested this so I'm speculating.

mohamed
Veteran Member
Posts: 80
Joined: 2020-04-19 16:18

Re: Search Crashes when searching Views using global-search.php

Post by mohamed » 2020-11-07 07:15

Yes you are right, AppGini treat VIEW tables like any other table, that's why I was able to link the VIEW tables to AppGini. The good think, I have managed to find a workaround to solve the search through VIEW tables :)
THANK YOU...
AppGini Pro 24.11 -
Calendar - Search Page Maker - Summary Reports - Mass Update - DataTalk -
bizzworxx AppGini Helper JabaScript Library - bizzworxx Inline Detail-View - bizzworxx Helper Pack - AppGini Helper Packaging Tool -
Udemy course

sacgtdev
Veteran Member
Posts: 75
Joined: 2020-06-10 11:14

Re: Search Crashes when searching Views using global-search.php

Post by sacgtdev » 2021-11-14 04:34

Hi mohamed,

I have similar objective as yours which is to allow user to view records which are inaccessible to them in the actual table.

I think we can create the view for each table and edit the global-search.php where:

/* get tables accessible by current user */
//$tables = getTableList();

//changed the above line with a custom-array for $tables = {'view1', 'view2'};

Check to check whether you are also having the similar solution.. Btw, above code have not tested yet.

Post Reply