Page 1 of 1

Outbound Parameters?

Posted: Wed Jul 12, 2017 9:55 pm
by dan.toadllc
How do I return a value from my LC customer component back to a variable in FileMaker?

My stack now appears when I run the line
Set Variable [$Output; Value: LC(“configuiv1”;”ABC”)]

So, “ABC” is an inbound parameter…and that is working great.
But now I want an outbound parameter as well.

There’s a bunch of JSON or XML I want to send back from LC to FM.
I don’t see this covered in the docs, but I assume it’s possible.

I suppose I can leverage FMPURL if necessary, but I’m assuming you have a better method.

Re: Outbound Parameters?

Posted: Thu Jul 13, 2017 12:28 am
by monte
Hi @dan.toadllc

You can use the `return` statement in either a function or custom component. It's probably simpler to leave the XML in LiveCode and access it from FileMaker although you could return it all as text if you want. So your custom component might be something like this:

Code: Select all

on FileMakerAction pAction
   local tResult
   switch pAction
       case "SomethingThatCreatesXML"
           put revXMLCreateTree("<some><thing>" & fmParam(1) &"</thing></some>", true, true, false) into tResult
           if tResult is not an integer then
              put fmErrorValue(tResult) into tResult
           end if
        case "GetXMLNodeContent"
           put revXMLNodeContents(fmParam(1),fmParam(2)) into tResult
           if tResult begins with "xmlerr" then
               put fmErrorValue(tResult) into tResult
           end if
   end switch
   -- tResult is the value that your action will return to filemaker
   return tResult
end FileMakerAction

Code: Select all

Set Variable [$xmlID; Value: LC(“configuiv1.SomethingThatCreatesXML”;”ABC”)]
Set Variable [$value; Value: LC(“configuiv1.GetXMLNodeContent”;$xmlID, "/some/thing")]
--> $value should be "ABC" now
You can return any of the data types listed in the FileMaker Interoperation > Values section of the Handbook ... ndbook.pdf

Re: Outbound Parameters?

Posted: Thu Jul 13, 2017 12:29 am
by monte
I have opened a report on improving the discussion of this in the handbook