Lisa Werdal wrote:
Hi -
I'm very new to learning Active4D. What I have been asked to do is
easy and small (for now). I'm just not sure how to call it.
I have written A4D code to perform a query. I have 2 input
parameters, and want a sting back. The input data will not come from
a form but call from another system and no html is needed.
Would I write it like this:
<%
method "External.a4d" ($vt_QueryName; $vt_QueryParam)
.....
return ($vt_Output)
To test, who would I send the parameters in a URL?
Lisa,
If I understand correctly you want another system, but not a browser to
call an A4D page. This really doesn't make a difference because a
request is a request regardless of the user-agent.
The call might look like this
http://www.example.com/External.a4d?qtype=foo&qval=bar
This would mean you'd run the foo query with input 'bar'
You'll be working with data that is in the _request collection.
The query type will be in _request{'qtype'}
The value to query on will be in _request{'qval'}
So your External.a4d method might have cases for each query.
method "External.a4d" ($vt_QueryName; $vt_QueryParam)
case
:($vt_QueryName = "foo")
` do "foo" using $vt_QueryParam here. Get $vt_QueryParam
:($vt_QueryName = "somethingelse")
` do "somethingelse" use $vt_QueryParam here. Get $vt_QueryParam
end case
return ($vt_Output) `Note that if you need to send $vt_Outptut back to
the requester you should user write ($vtOutput)
hth,
Brad
_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/