Sub-Grids with multiple parameters

QuestionsSub-Grids with multiple parameters
Mike Sheppard asked 9 years ago

I can't seem to get multiple parameters to work on sub-grids.

I am using your examples as a starting point – but the second variable does not seem to pass into the sub-report correctly.

It seems the only way I can keep a variable passed is to use $_REQUEST['rowid'].

I do not understand why I cannot use a separate sub-grid and pass-in the $_POST[].

Any advice would be appreciated.

Main page:
$grid["subGrid"] = true;
$grid["subgridurl"] = "shelf_life_sub.php";
$grid["subgridparams"] = "PART_ID,ID,LOCATION_ID";

And on the Sub-grid page:
$partid= $_POST["PART_ID"];
$traceid=$_POST["ID"];
$grid->select_command = "SELECT DATA1, DATA2, DATA3 FROM TABLE WHERE PART_ID = '$partid' AND TRACE_ID = '$traceid'";

4 Answers
Abu Ghufran answered 9 years ago

I am working on this issue and will be updating it soon.

Current process is to persist the POST data in session and then use in query.

if (!empty($_POST["personid"]))
{
$_SESSION["personid"] = $_POST["personid"];
}
$pid = $_SESSION["personid"];
and use `$pid` in your SQL.

Mike Sheppard answered 9 years ago

Thanks for the reply.

I tried many, many combinations of trying to use $_SESSION variables without success – it was getting rather frustrating.

I just used your method (with the (!empty())but it still seems to be generating incorrect data as I switch from one-field to the next (the POST is not replacing itself – it seemed to work the first-time, but not as I click on each additional field).

Do you think I need to clear the session at some-point?

Thanks for the support.

Mike

Mike Sheppard answered 9 years ago

I have a better explanation of what's happening (now that I've had a chance to implement your method with the !empty().

I have two keys to check – PART_ID and ID.

The PART_ID corresponds to the $_GET['rowid'] field.

It is returning multiple values (say 10).

The ID corresponds to the $_POST['ID'] field. It is returning the secondary value (why there are 10-versions of the Part ID).

When I run the sub-report – the $_POST['ID'] is actually the last-entry in the list for every instance of the PART_ID. So the same sub-grid appears no-matter which Part ID you select.

I hope that makes sense.

Any thoughts?

Thanks

Mike

Abu Ghufran answered 9 years ago

Emailed you a working demo.

Your Answer

3 + 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?