This topic is locked
[SOLVED]

 Passing a filed value to another page

6/5/2020 7:45:13 AM
PHPRunner General questions
gehrenfeld author

I have two REST views.

The view Item Description has field: fdcId, description, brandOwner.

The view FoodsView has fields: fdcId, description, brandOwner, nutrientId, nutrientName, nutrientNumber.
What I want to do is make the Item Description fdcId field clickable so when a user clicks on it, the Item Description fdcId is sent to FoodsView and search for FoodsView fdcId.
I hope that makes sense.

Sergey Kornilov admin 6/5/2020

Step 1: run that search manually, note the URL
Step 2: set 'View as' type of that field to Custom and craft the same search link in your code.
You can see some ideas here:

https://xlinesoft.com/phprunner/docs/add_a_dropdown_list_box_with_specific_values.htm

gehrenfeld author 6/5/2020



Step 1: run that search manually, note the URL
Step 2: set 'View as' type of that field to Custom and craft the same search link in your code.
You can see some ideas here:

https://xlinesoft.com/phprunner/docs/add_a_dropdown_list_box_with_specific_values.htm

gehrenfeld author 6/5/2020



Step 1: run that search manually, note the URL
Step 2: set 'View as' type of that field to Custom and craft the same search link in your code.
You can see some ideas here:

https://xlinesoft.com/phprunner/docs/add_a_dropdown_list_box_with_specific_values.htm


The problem is that I am using a REST API view. There are no table for RREST API's.

Sergey Kornilov admin 6/5/2020

How is that relevant? Did you even try it?

gehrenfeld author 6/5/2020



How is that relevant? Did you even try it?



Yes, I did. Here is what I did.
$str= "<select style='width: 150px; display: inline-block;' class='form-control' onchange=\"window.location.href=this.options[this.".

"selectedIndex].value;\"><option value=\"\">Please select</option>";

//select values from the database

$strSQL = "select fdcId from itemDescirption";

$rs = db_query($strSQL);

while ($data = db_fetch_array($rs))

$str.="<option value='food_list.php?q=(fcdId~equals~".

$data["fdcId"].")'>".$data["fdcId"]."</option>";

$str.="</select>";

echo $str;
I built it. The error I get is no such table.

R
RogerN 6/6/2020

A little question, is this spelled right: $strSQL = "select fdcId from itemDescirption";?

Can it be itemDescriptioninstead?

gehrenfeld author 6/7/2020



A little question, is this spelled right: $strSQL = "select fdcId from itemDescirption";?

Can it be itemDescriptioninstead?



I made the spelling error correction.

I get

Table 'foods.itemdescription' doesn't exist

URL localhost/foodsview_list.php?qs=apple

Error file C:\Users\ehren\Documents\PHPRunnerProjects\food\output\connections\Connection.php

Error line 626

SQL query select fdcId from itemDescription
I need to try and explain it better. I can't figure out how to add screenshots to a post so I will give it a shot.

When I run ItemDescription I get a search window (I have hide data until search).

I then type food item I am looking for in the search. It then returns a list of all the food items with apple.
Fdc Id Description

454004 Apple

786813 Apple coder

786943 Apple juice, baby food
Then load the FoodView and enter the fdcId in the search field (I have hide data until search) and it gives me the nutritional list for that item.

I want to make the fdcId list in ItemDescritpion a link so the user can click on the fscId they want then that fdcId is passed to FoodView and have it list the nutritional information for that fdcId.
I am getting the information using an API is the return data is JSON, so there are no tables. I have programmed it in PHP and it works with no problems.

I do not know how PHPrunner 10.4 works with a REST View.
I hope I have done a better job of explaining what is going on.
Thank you

M
MikeT 6/7/2020

Take a look at this video: https://www.youtube.com/watch?v=zNq7E_0n9Os
It's explaining the setup for a setup like this, I think.

gehrenfeld author 6/7/2020



Take a look at this video: https://www.youtube.com/watch?v=zNq7E_0n9Os
It's explaining the setup for a setup like this, I think.




That is what I wanted.

Thank you!