Aliased columns on JOIN

QuestionsAliased columns on JOIN
Ken asked 7 years ago

This software seems to have a hell of a hard time dealing with aliased columns on a JOIN. I can't get them to show on the grid about half the time, even though my code between php programs is very similar — just the query part is different.

Example: $g->select_command = "SELECT prim_key, a.file_name , a.sign_date, CONCAT(b.firstname, ' ', b.lastname) AS person FROM vdocs a JOIN vmems b ON b.groupId = a.vendor_id AND b.member_id = a.vdoc_mem_id "

The field "person" will not show up in the grid, even though it looks like pretty simple code to display it. And yeah, it DOES show up in my phpmyadmin when I do a query.
The grid 'definition' is this:
$col = array();
$col["title"] = "Signed By";
$col["name"] = "person"; // grid column name, same as db field or alias
$col["width"] = "40";
$col["editable"] = false;
$col["search"] = false;
$cols[] = $col;

It doesn't work when I prefix the field with the table name, when I use it as "b.person", when I use it as "person" AND it doesn't even work if I just select 'lastname' and use that in '$col["name"]'. It doesn't show up in the JSON Response, so yeah I see that. But I don't care — I'm not the one who wrote the JSON; I'm just trying to save time writing reports and I seem to be wasting it instead of saving it.

So what's the deal here? I've had the same issues with almost EVERY OTHER alias I've used with phpgrid. I've poured over the forums and the documentation and nothing I see answers this.

6 Answers
Abu Ghufran answered 7 years ago

Please share complete code for review.
You can use OR email me at [email protected]

Ken answered 7 years ago

I'll email it to you a bit later, because I gave up on this grid for this report. This should have been simple, as it only requires a display of four columns, although the data is from 3 different tables (our tables are heavily normalized). I re-wrote the program using standard HTML and SQL to render the correct data, along with filters to select certain groups. I wrote it 'from scratch' in a little over 40 minutes. I've been fighting with your grid for over 3 days trying to get it to render the same data.
So when I get caught up on the time I've wasted on this, I'll email the code to you for your comments. Thanks

Ken answered 7 years ago

Ok, I've emailed you the code.

Abu Ghufran answered 7 years ago

This case was resolved via remote session.
Issue was in syntax of query and fixing it solved the issue.

@John, please share code for review. I'll review and suggest whats missing.

G. Nalu answered 7 years ago


any news about this issue?

I have the exact same problem, same grid, search/dropdown works for every column except the name column.



Patricia answered 6 years ago

So thanks – this is SO Frustrating: couldn’t you describe the type of syntax errror that you fixed for Ken so that other people could get an idea of how to handle this when we have the same problem??!!

I have the exact same problem – works sometimes, doesn’t in others. If i knew what kind of syntax error you fixed for Ken at least that would be a starting place for me to look in my query….

Abu Ghufran Staff replied 6 years ago

This ticket is quite old and i don’t remember it now.
Please post your question again and i’ll review it again.

(‘d be better if you open new ticket)

Your Answer

15 + 5 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.

How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?