Access Text Display output in its procedure


#1

A Text Display has a formula and a procedure. How do I use the result of the formula in the procedure?

For instance, using literal mode and the formula http://www.example.com/«id» to display an integer field, how can I pass the result to openurl( when the text is clicked?

I only found info( which looks like overkill.


#2

If you change the Text Display Object to formula mode and change the formula to :

"http://www.example.com/"+«id»

You could then use something like this in the procedure to do the openurl:

execute "openurl "+objectinfo("formula",info("clickedobjectid"))

Obviously the most straight forward method would be to just directly use the same formula in the procedure itself:

openurl "http://www.example.com/"+«id»

Of course I might be misunderstanding the problem altogether.


#3

That’s what I was trying to avoid, so I don’t have to make every change in two places.

But it looks like Text Display objects have no property exposing the current output, after calculating the formula.

Thank you for pointing out execute!


#4

It’s definitely more difficult than it should be, but it is possible. Here is code that can be triggered by a Text Display object in literal mode, at the end, displayedtext will contain the text that is displayed (I just tried it and verified that it works). This code displays the value with the message statement, but you could use openurl or whatever you want.

let tformula = objectinfo("formula",info("clickedobjectid"))
local displayedtext
formulamerge tformula,displayedtext
message displayedtext

Note that a slightly different program would be required if the text display object used formula mode, like this:

let tformula = objectinfo("formula",info("clickedobjectid"))
let displayedtext = formulavalue("",tformula)
message displayedtext

This could be simplified into one line:

message formulavalue("", objectinfo("formula",info("clickedobjectid")))

Of course you could use objectinfo( to figure out which mode was being used and trigger the appropriate code.


Since Panorama already knows what this value was, it would be nice if there were a simpler way to determine this value. I’ve put this on the to-do list.