Home News Contact Us Forum About Us Demos Products F.A.Q.
Shopping Cart
You currently have 0 items in your cart.


Recent Events
  • 23/11/2024 Black Friday 2024

    BIG SALE, 30% discount for all our extensions. Use BF24 coupon code. Hurry up the discount is valid till 3 December.

  • 31/12/2023 New Year SALE

    We are glad to announce New Year SALE. 25% discount for all our extensions. Use NY24 coupon code. Hurry up the discount is valid till 7 January.


2Checkout.com, Inc. is an authorized retailer of goods and services provided by ARI Soft. 2CheckOut




Follow us on twitter



Welcome, Guest
Please Login or Register.    Lost Password?

Pass a parameter to a SQL Query
(1 viewing) (1) Guest
Go to bottomPage: 12
TOPIC: Pass a parameter to a SQL Query
#67157
Pass a parameter to a SQL Query 4 Years ago Karma: 0
Hi,

I'd like to make my Data Tables query (the "SQL query" setting) include reference to a parameter I pass in the URL so I can navigate from a master list of data to the detail list. I figure I would use something like this in the SQL query but it doesn't work;

SELECT * FROM detailtable where foreignkey=$_GET['id']

Can I do this? If so, how?

Bill
The administrator has disabled public write access.
 
#67158
Re:Pass a parameter to a SQL Query 4 Years ago Karma: 760
Hello,

Use the following query:

Code:


SELECT * FROM detailtable WHERE foreignkey= {$REQUEST:id}



Regards,
ARI Soft
The administrator has disabled public write access.
 
#67159
Re:Pass a parameter to a SQL Query 4 Years ago Karma: 0
Thank you. Your answers always work first time!

On the calling screen I have a data table. I want one of the fields to link to the detail table on the second screen, so in the SQL for the calling screen I have this:

SELECT '/index.php/items?keyfield='+[keyvalue] as keyfield
,...other fields...
FROM [mastertable]
order by keyfield

In the "Columns settings" section I set "Recognize Links" to "Yes" for this field. It renders a URL but the hovering over the URL gives me:

index.php/items?keyfield=KEYVALUE1

which isn't a valid link in itself. If I could add a "/" at the front it would be. Also I'd like to just display KEYVALUE1 in this field, but it displays a link which includes KEYVALUE1.

What is the right way to set up a clickable link in this field?

Bill
The administrator has disabled public write access.
 
#67160
Re:Pass a parameter to a SQL Query 4 Years ago Karma: 760
Hello,

You can use "Columns settings" parameters section to apply custom formatting for particular columns. For example if you want to format "keyvalue" field, populate "Columns settings -> ID" parameter with keyvalue value and populate "Columns settings -> Format" with the following value:

Code:


<a href="/index.php/items?keyfield={$value}">{$value}</a>



Regards,
ARI Soft
The administrator has disabled public write access.
 
#67162
Re:Pass a parameter to a SQL Query 4 Years ago Karma: 0
Almost there...

It seems {$value} is not available inside the Format field. Removing all the anchor-related HTML, no variant of {$value} is injected into the HTML.

{$value} injects an empty string
${value} injects the string "${value}"

I checked my SQL. It works in MSSQL studio. It works as a query in Excel. It just doesn't display the {$value} field if that's in the Format field.

Ideas?

Bill
The administrator has disabled public write access.
 
#67163
Re:Pass a parameter to a SQL Query 4 Years ago Karma: 760
Is it possible to see the problem anywhere? Probably you can setup a test env and provide a temporary access to your J! backend by email so we can investigate the problem in more details?

Regards,
ARI Soft
The administrator has disabled public write access.
 
Go to topPage: 12