Translate relationship id to its value
Translate relationship id to its value
Hi folks,
Sorry, I don't know what this is called in technical terms.
How do I make the table show the value of the relationshiped table?
My statuses are table:
contact_status
In the contact table I have a column, status.
The status table is all the id's from the contact_status table, 1,2,3, etc. 1=lead, 2=followup, 3=active, etc.
I'm using ssp, and I want to show certain statuses, but not all of them.
$where = "status ='3' OR status = '4' OR status = '5' OR status = '6' OR status = '9'";
But then in the table, under the status column, it's all the numbers as it should be, right?
How can I get this to move over to show "active" instead of 3?
Replies
This seems to break the search ability:
require( 'ssp.class.php' );
$where = "status ='3' OR status = '4' OR status = '5' OR status = '6' OR status = '9'";
echo json_encode(
SSP::complex( $_GET, $sql_details, $table, $primaryKey, $columns, $where )
);
Anyone have suggestions?
Tried parentheses as suggested here:
https://datatables.net/forums/discussion/31244/multiple-or-in-where-clause-breaks-filter-search
$where = ("status = '4' OR status = '5'");
Nope, not working. Going to move the parentheses
and I just tried:
$where = "(status = '4' OR status = '5')";
seems to work!
Tried:
$where = "(status = '4' OR status = '5' OR status = '6' OR status = '9')";
Yup, still working.
Thanks guys! You're great!
Still looking for a way to get the numbers to show as the value though.
So, any help there would be awesome.
You could use
columns.render
to change the numeric value to be the string, but then you would need to also map those rendered strings back to the numeric value on the search as that's being performed on the server.The render would be something like:
Colin
Ok, got it. Thanks Colin!