Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Message to variable? 2

Status
Not open for further replies.

simetra

Programmer
May 24, 2001
22
US
Hi
Within a .tsc, I want to feed an inbound message to another tsc, and get the results back in a variable. However, I don't want to put it into ~output. Then, after having that message in a variable, I want to reference one of the subnodes. Is this possible? If so, what syntax to I use to reference the subnode in the variable?
Here's a quick outline of what I'm trying:

(load SECOND_TSC.tsc)
(let MESSAGE (SECOND_TSC ~input))
(let COUNTX (count MESSAGE.subnode))

Thanks!
 
Hello !

All the things You are doing are right, except one small error.
Check in "Monk Developer’s Reference" difference between let and set! functions. In your code Your should use either set! function with prior variable definition, either You should include count un prior LET block. In your code MESSAGE is not visible at third line.

So, there are some examples:
i:
(load SECOND_TSC.tsc)
(let* ((MESSAGE (SECOND_TSC input))
(COUNTX (count ~MESSAGE%subnode))
)
)

ii:
(load SECOND_TSC.tsc)
(let ((MESSAGE (SECOND_TSC input))
(COUNTX -1)
)
(set! COUNTX (count ~MESSAGE%subnode))
)

iii:
(load SECOND_TSC.tsc)
(let ((MESSAGE "")
(COUNTX -1)
)
(set! MESSAGE (SECOND_TSC input))
(set! COUNTX (count ~MESSAGE%subnode))
)

Regards,
Romans Krjukovs
 
Thanks!
When I do this, using LET, in the logs I get an error that the variable MSG, which I'm using to hold the contents of the second tsc, is not defined.
I tried to use (define MSG "") but it doesn't like that. I suspect it wants something like (define MSG event), but am not sure what syntax to use.
Thanks again
 
Hello !

Regarding your last message: collaborations (also subcollaboration) receive input events as a strings. This is true also about collaborations result - events are returned as a strings.
So, problem (AFAICS) is that MSG variable, probably, is event map and we can't assign string to this variable.
We have to pasre our string. Like this:
($event-parse MSG string).

But wait! What do You mean with this:
"variable MSG, which I'm using to hold the contents of the second tsc" ?
.tsc file holds function defintion.

I don't like SeeBeyonds approach of subcollaborations: instead of esxplaining what is what and how it works, they usualy try to teach how to make subcollaborations. And you if look into the code of subcollaboratins - u'll see how ineffective it is. I would say - try to avoid subcollaboration usage while You not absalutely sure u need them. Better use simple function instead.

Back to problem - i'll be glad to help if You would explain the details and publish collaborations code.
Feel free to contact me directly: Romans.Krjukovs@verdi.lv

Regards,
Romans
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top