I'm really enjoying using Tersus. I can see how I could easily get hooked on this application.
I checked the forum but didn't find any reference to passing paramters from the browser to the an application. I'm trying to pass an ID to the app, but can't seem to figure out how to do it.
Is this possible? And if so, how do I go about doing it?
Thanks,
Paul
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You can add additional parameters e.g. http://localhost:8080/Project/#Perspective=<Perspective>&View=<View>&ID=<ID>
And access the Id in the model using Get View Parameters. Each exit of 'Get View Parameters' is identified with a parameter from the url (so in this case you would add an exit called ID). The type of the exit can be textual or numeric (dates and booleans should also work, but I don't remember testing it).
Regards,
Youval
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As you've probably discovered your parameters (such as ID) are dropped from the url once you switch to another view.
I think the easiest method to pass your parameters to another view would be to save the parameter values to the database (probably when you 'Get View Parameters' on init of first view), and read it from the database on init of the second view.
Regards,
David - support@tersus.org
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That's exactly what I discovered. I tried implementing a cookie, but I think I was doing something wrong. I thought of the database approach too. Either way, I think the issue that I have is where to put the action.
When I come back to the view, it will create the cookie or store the data in the database again and again. Is there a way to know the first time a view is opened? Or, would it make sense to have a view (this seems to be an oxymoron) that is invisible. That would be what my browser first calls, but then I switch to a "visible view".
Regards,
Paul
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What you could do is the following:
On init of the first view, after parsing the parameters from the URL, replace the URL with a new one, by using a 'Display Actions/Create Location' with no triggers (creating the basic tersus URL for the view) and sending the <URL> to a 'Display Actions/Go To URL' with an additional <Relative> trigger receiving a "Yes" constant. Note that both templates mentioned have comments which explain these and other possible triggers.
Regards,
David - support@tersus.org
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That sounds like a great solution (using the cookie). For what I'm trying to do, the database solution would be very complicated - since the application is multi-user, and it's possible to have someone logged in from two diffrent positions. With the cookie, it is local to the machine they are on.
Much appreciated,
Paul
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I implemented your cookie recommendation and it works well. There was one slight change that had to be made to get it to work. "Set Cookie" also requires a "control". I created a flow from the "Exits/<Yes>" to the "control" I created on "Set Cookie".
Nice solution ... thank you.
Paul
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm really enjoying using Tersus. I can see how I could easily get hooked on this application.
I checked the forum but didn't find any reference to passing paramters from the browser to the an application. I'm trying to pass an ID to the app, but can't seem to figure out how to do it.
Is this possible? And if so, how do I go about doing it?
Thanks,
Paul
Hi Paul. Thanks for the feedback!
You can use the plugin 'Get View Parameters':
The normal URLs used by the system look like: http://<Host>:8080/Project/#Perspective=<Perspective>&View=<View>
The <Perspective> and <View> parameters tell the platform which view should be displayed.
You can add additional parameters e.g. http://localhost:8080/Project/#Perspective=<Perspective>&View=<View>&ID=<ID>
And access the Id in the model using Get View Parameters. Each exit of 'Get View Parameters' is identified with a parameter from the url (so in this case you would add an exit called ID). The type of the exit can be textual or numeric (dates and booleans should also work, but I don't remember testing it).
Regards,
Youval
That is priemo! Wow.
It's obvious that the ID is passed to view. How do the other veiws get access to it?
Thanks,
Paul
As you've probably discovered your parameters (such as ID) are dropped from the url once you switch to another view.
I think the easiest method to pass your parameters to another view would be to save the parameter values to the database (probably when you 'Get View Parameters' on init of first view), and read it from the database on init of the second view.
Regards,
David - support@tersus.org
David,
That's exactly what I discovered. I tried implementing a cookie, but I think I was doing something wrong. I thought of the database approach too. Either way, I think the issue that I have is where to put the action.
When I come back to the view, it will create the cookie or store the data in the database again and again. Is there a way to know the first time a view is opened? Or, would it make sense to have a view (this seems to be an oxymoron) that is invisible. That would be what my browser first calls, but then I switch to a "visible view".
Regards,
Paul
Paul,
What you could do is the following:
On init of the first view, after parsing the parameters from the URL, replace the URL with a new one, by using a 'Display Actions/Create Location' with no triggers (creating the basic tersus URL for the view) and sending the <URL> to a 'Display Actions/Go To URL' with an additional <Relative> trigger receiving a "Yes" constant. Note that both templates mentioned have comments which explain these and other possible triggers.
Regards,
David - support@tersus.org
I would rather use the following solution:
In the initialization of your views, use a common action 'Get Id' that works as follows:
- If the view parameter exists, save its value in a cookie and return it
- Otherwise, retrieve the value from the cookie
See http://downloads.tersus.com/support/get_parameter_or_cookie.gif
If you use a database record instead of a cookie, you probably want to include the user id in the record's primary key.
Regards,
Youval
Youval,
That sounds like a great solution (using the cookie). For what I'm trying to do, the database solution would be very complicated - since the application is multi-user, and it's possible to have someone logged in from two diffrent positions. With the cookie, it is local to the machine they are on.
Much appreciated,
Paul
Youval,
I implemented your cookie recommendation and it works well. There was one slight change that had to be made to get it to work. "Set Cookie" also requires a "control". I created a flow from the "Exits/<Yes>" to the "control" I created on "Set Cookie".
Nice solution ... thank you.
Paul
Set Cookie/<Value> is non-mandatory by default but can be set as mandatory, making the additional Control trigger redundant.
Regards,
David - support@tersus.org