MC front end to PostgreSQL, help!
Sadhunathan Nadesan
sadhu at castandcrew.com
Mon Jan 27 09:52:01 EST 2003
Help!
Summary: next card not working for multiple sql data records
Context;
I'm building an application using the approach demonstrated by Pierre -
MC front end sends post request to web cgi back end which communicates
with PostgreSQL.
In my case I want something that is similar to the old Windows 3.1 card
file (since I have a lot of data collected over the years in that format)
- namely, a 2 field record: a title field (string), and a contents field
(unlimited free form text).
The application is working pretty well at this point. Once I'm happy
with it, will post the whole thing. BTW, I'm using just a one part back
end rather than two part as in Pierre's example, but same basic idea.
Problem:
The search feature I have at the moment allows you to specify a wild
card type pattern. So this could return several matching records.
Each record would be one line with two fields separated by the pipe
symbol, "title|contents", such as
Joe|Joe lives at the downtown YMCA, cell phone 555-1212
Tom|contact Tom by email at tom at foo.com
Mary|had a little lamb
etc. I can confirm this type of data is being returned to the MC
front end.
What I want it to do is, create several new cards, one for each line of
data, so the user can wind back and forth between them.
Solution:
I probably need something changed on the "create card" command or
something like that?? If I just put 'go to next card' without the create
I end up with only one card. But if I put 'create card' I get a new card
but without any of the fields, yet, I have all the fields grouped as a
background group?? Anyway, it's not working.
Suggestions appreciated.
Here is a code snippet:
on AzzSearch
put "action=search&" into azzdata
put "title=" & field "title" after azzdata
set httpheaders to "Content-type: application/x-www-form-urlencoded" & return
post urlEncode(azzdata) to url ("http://localhost/cgi-bin/azz.mt")
put it into sqldata
if (the number of characters in sqldata is zero) then
answer "Sorry, no such address card" & cr
else
repeat for each line this_line in sqldata
visual effect scroll left
#go to next card
create card
split this_line by "|"
put this_line[1] into field "title"
put this_line[2] into field "contents"
save this stack
end repeat
end if
end AzzSearch
More information about the metacard
mailing list