Dynamic URL in Genie charts
-
- New User
- Posts: 13
- Joined: Mon Aug 15, 2016 6:24 pm
- First Name: Dustin
- Last Name: Miles
- Company Name: Unipres USA
- Contact:
Dynamic URL in Genie charts
When setting the dynamic URL property on a chart in genie, is it possible to make the URL variable? I would like to pass a parameter in the url (i.e. chart.php?var=MyVar) and have this be different based on conditions in the program. Is something like this possible?
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Dynamic URL in Genie charts
You can set any property with JavaScript code by starting that property with "script:". Genie will run the property through a JavaScript interpreter, and assign the output to the property.
So, for example, you could set the url to:
Genie would retrieve a field with an ID of D_1_20, encode it so that it works nicely in a URL, and add it into the URL.
One thing that's important to consider is that these properties are activated when the screen loads, so any variables need to be set when the screen is sent to the display. That shouldn't be a problem if they are coming from the IBM i application.
So, for example, you could set the url to:
Code: Select all
script: "/path/to/chart.php?myVar=" + encodeURIComponent(get("D_1_20"))
One thing that's important to consider is that these properties are activated when the screen loads, so any variables need to be set when the screen is sent to the display. That shouldn't be a problem if they are coming from the IBM i application.
-
- New User
- Posts: 13
- Joined: Mon Aug 15, 2016 6:24 pm
- First Name: Dustin
- Last Name: Miles
- Company Name: Unipres USA
- Contact:
Re: Dynamic URL in Genie charts
Yes, this is exactly what I was looking for. Thank you!
Who is online
Users browsing this forum: Google [Bot] and 0 guests