Outbound Parameters?

This is the place to discuss all things relating to using LiveCode For FM, the LiveCode interface for FileMaker.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Outbound Parameters?

Postby dan.toadllc » Wed Jul 12, 2017 9:55 pm

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.
dan.toadllc
 
Posts: 1
Joined: Thu Mar 30, 2017 7:58 pm

Re: Outbound Parameters?

Postby monte » Thu Jul 13, 2017 12:28 am

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
           break
        case "GetXMLNodeContent"
           put revXMLNodeContents(fmParam(1),fmParam(2)) into tResult
           if tResult begins with "xmlerr" then
               put fmErrorValue(tResult) into tResult
           end if
           break
   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 http://downloads.livecode.com/filemaker/LiveCodeForFMHandbook.pdf
Last edited by monte on Thu Jul 13, 2017 12:31 am, edited 1 time in total.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/
monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 1558
Joined: Fri Jan 13, 2012 1:47 am

Re: Outbound Parameters?

Postby monte » Thu Jul 13, 2017 12:29 am

I have opened a report on improving the discussion of this in the handbook http://quality.livecode.com/show_bug.cgi?id=20075
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/
monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 1558
Joined: Fri Jan 13, 2012 1:47 am


Return to LiveCode for FM

Who is online

Users browsing this forum: No registered users and 1 guest