RTD Server Topic strings - optional parameter

Add-in Express™ Support Service
That's what is more important than anything else

RTD Server Topic strings - optional parameter
How to arrange for optional RTD topics 
Tor Erik Dahlsrud




Posts: 3
Joined: 2013-09-09
Hi

I would like to achieve the following in a RTD function. For example:
=RTD("MyServer.rtd"; ""; "MyTopic")
-and-
=RTD("MyServer.rtd"; ""; "MyTopic"; "Specifier")

In normal cases, the RTD funtion only takes 1 wildcard (*) topic ("MyTopic" in my example) which returns data in the default format.
But I'd like to offer to the user the added feature of optionally specifying a "Specifier" that changes the data in a server dependent way.

In TadxRTDTopic.String01-28 I can specify either a string, an asterix * or nothing.
However, it seems that the asterix demands a value for that string and does not allow an empty string as parameter. And that is (I think) a problem for my above scenario.

If I specify:
String01=*
String02=
String03=
Then the first example above works, but not the second (it returns 'Unrecognized')

If I specify:
String01=*
String02=*
String03=
Then the second example above works, but not the first (it returns 'Unrecognized').

I would like a setup where both example works.

I can't find any documentation for the what possibilities the Stringnn properties offer.
Is there a way to achieve optional RTD parameters like I describe?

Thank's.
Posted 09 Sep, 2013 04:39:52 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Tor,

You can wrap the RTD call into a UDF call as described in the section Inserting the RTD Function in a User-Friendly Way in the manual, see the PDF file in the folder {Add-in Express}\Docs\ on your development PC.

This allows hiding the fact that an extra parameter is always passed to the RTD and in this way allow your users to choose whether to input the last parameter or not.

This is, let the RTD require two prarmeters. When the user calls the UDF passing just one parameter, the UDF calls the RTD passing the default value of the second parameter.

What do you think?


Andrei Smolin
Add-in Express Team Leader
Posted 09 Sep, 2013 08:12:55 Top
Tor Erik Dahlsrud




Posts: 3
Joined: 2013-09-09
Andrei,

Thank you for your answer.

I am aware of UDF calls, and I was hoping to avoid them, because it is much more difficult to explain to the users to write a UDF than adding an extra empty parameter to the RTD call.

I am not sure if this is a limitation in the RTD protocol itself, or if it depends on the Add-in Express implementation. If it depends on you, I would like to add as a feature request the option to allow empty parameters.

For example, by using another character, it could behave like * but allow empty string.

Thank's
Posted 09 Sep, 2013 08:21:05 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
I was trying to work around this by adding two topics having these parameters:

​topic #1: String01="MyTopic", String02="*"
​topic #2: String01="MyTopic", String02="*", String02="*"

Here I've run into an issue in Add-in Express: it may invoke an incorrect topic in this situation. Obviously, something is wrong in the topic indentification mechanism. The issue is now filed under #4880 in our bug-tracking DB. When the issue is fixed, you'll find that number in whasnew.txt. The new build is scheduled for November. If it is fixed earlier, we will send you an assembly providing the fixю


Andrei Smolin
Add-in Express Team Leader
Posted 09 Sep, 2013 10:41:40 Top
Tor Erik Dahlsrud




Posts: 3
Joined: 2013-09-09
Thank's. Great!

But just to clarify. In my project, the topic "MyTopic" is not defined in the TadxRTDTopic in Delphi at all. It was just an example topic for Excel, in the RTD function call. So in Delphi, I'll continue to have String01=* and String02=* so that both will react to any text coming to them. The only change I would like to see is that String02 (and higher strings too) should be allowed to be empty. I think this is the case you are proposing too, but just to be certain that there aren't any misunderstandings. Solving it by 1 or 2 topics is of course up to you.

So what I am looking for is the easiest way to call RTD such as this:
=RTD("MyServer.rtd"; ""; "anytext")
=RTD("MyServer.rtd"; ""; "anytext"; "empty-or-anytext")
or for that matter:
=RTD("MyServer.rtd"; ""; "anytext"; "empty-or-anytext"; "empty-or-anytext")
(in which case I want to be able to have two optional parameters instead of just one. In fact, any amount of optional parameters would be great - solving it with only one TadxRTDTopic would maybe be easier?).
Posted 09 Sep, 2013 11:08:19 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Tor,

Tor Erik Dahlsrud writes:
The only change I would like to see is that String02 (and higher strings too) should be allowed to be empty.


The strings passed to a topic is the only way to identify the topic. Consider two topics:
topic #1 accepting 2 parameters: "*", "*".
topic #2 accepting 1 parameter: "*".

If the user passes RTD(...,"someString") and the second parameter may be omitted, it isn't possible to identify the topic to invoke.

I apologize for referring yout to a wrong issue idnetifier, the correct identifier is #4881, not #4880. In fact, we expect to have a fix for this today. Supposedly, it will be a modification of the Add-in Express code. If so, I'll send it to you in a separate email.


Andrei Smolin
Add-in Express Team Leader
Posted 10 Sep, 2013 05:40:55 Top