This topic is locked

Link from List page to a specific Dashboard record

5/29/2017 3:14:48 PM
PHPRunner General questions
S
seedavidwork author

I have a dashboard to show details for the master table "job" with primary key "job_id". I am trying to use the "Click actions..." or any other method, to allow a record which has been clicked on in the "List page" to redirect to the Dashboard showing the record with the matching "job_id".

mbintex 5/30/2017

I do something similar. From a list I switch to related records in other tables.
Snippet looks like this:
Nothing in "Client Before".
This in "Server":

$data = $button->getCurrentRecord();

$kurzname = $data["Adresse"];
$link = "Adressen_list.php?q=%28ID~equals~".$kurzname."%29";
$result=$link;


and in Client After this:

document.location.href = result;
A
Athlon 5/30/2017

I believe you are meaning this:
Simply add code to the field itself.

select Custom and add something like this.
////lookup main ID of resident

global $dal;

$tblUsers = $dal->Table("cp1");

$tblUsers->Param["UniueID"]=$data["UniqueID"];

$rs = $tblUsers->FetchByID();

while( $data = db_fetch_array($rs) )

{

$myID = $data["CP1ID"];

//$mDate = $data["CP1_Next_Review"];

}
//$value = $mDate;
// if review date is out - set a red star and link to edit page.

if ($value < now())

{

$value = date("d/m/Y", strtotime($value));

$color="red";

$link = '<a href="cp1_edit.php?editid1='.$myID.'" style="text-decoration: none"> <img src="red.png" alt="Edit" </a>';

}

else

{

//link to view page

$value = date("d/m/Y", strtotime($value));

$color="green";

$link = '<a href="cp1_view.php?editid1='.$myID.'" style="text-decoration: none"> <img src="green.png" alt="" </a>';

}

$value = "<span style='color: " . $color . ";'>".$value."</span>".$link;

S
seedavidwork author 5/30/2017

I am redirected to the correct Dashboard with a URL that matches what I would expect to see based on the button code you shared, but the URL
http://10.211.55.6/test/Jobs_dashboard.php?q=%28ID~equals~10%29
Is not filtering the Dashboard so that only record with job_id 10 is showing. Perhaps I am not formatting the URL correctly to filter a Dashboard for the specific record I am looking for.
My goal is that when I land on the page Jobs_dashboard.php (which has records and details all related to a specific job_id) I see the record based on the job_id of the link I have selected without having to search for it manually.



I do something similar. From a list I switch to related records in other tables.
Snippet looks like this:
Nothing in "Client Before".
This in "Server":

$data = $button->getCurrentRecord();

$kurzname = $data["Adresse"];
$link = "Adressen_list.php?q=%28ID~equals~".$kurzname."%29";
$result=$link;


and in Client After this:

document.location.href = result;