web app to query csv file and display results

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
mbernard
Posts: 2
Joined: Wed Nov 04, 2009 6:55 pm

web app to query csv file and display results

Post by mbernard » Fri Nov 13, 2009 5:22 pm

I'm extremely new to Rev Media, programming for that matter. I've been a web designer, but have a dilemma. I need to create a web app that allows people to go to the site, enter in there name and submit to query a csv file that then will display the records found in the csv that match their name.

Help.... how can I do this?

Thanks,
Mark

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: web app to query csv file and display results

Post by sturgis » Fri Nov 13, 2009 9:09 pm

From your description, it sounds like you are talking about using a revlet in a web page that needs to grab data from a static CSV file, yes?

Probably the simplest way is to put the whole csv into a variable. I am guessing that the csv file is on a web server somewhere, so your program could have a line like

Code: Select all

put url "http://example.url.com/csvtextfile.csv" into theVariable
At which point you can just search through the variable for lines matching your search term.

Some items to look up in the rev dictionary for this sort of search thing would be lineOffset, itemOffset, (and the other various offsets), matchtext..

If the csv file is huge of course, then an alternate method would be required. Also, if security of the data in the csv file is an issue, again there are most likely better options, but should give you some stuff to experiment with.
mbernard wrote:I'm extremely new to Rev Media, programming for that matter. I've been a web designer, but have a dilemma. I need to create a web app that allows people to go to the site, enter in there name and submit to query a csv file that then will display the records found in the csv that match their name.

Help.... how can I do this?

Thanks,
Mark

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Contact:

Post by trevordevore » Sat Nov 14, 2009 2:16 am

There is a visual example of what sturgis suggested in the lesson.runrev.com site:

How do I get the content of a URL on a web server into Revolution?

After you get the data and use one of the operators that sturgis suggested you can use this lesson to help you display your data in a table field.

How do I Display Tab Delimited Text in a Table Field?

The lesson shows how to do this with tab delimited text. You can convert a basic CSV file to tab delimited use replace:

Code: Select all

replace comma with tab in theCSVData
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

mbernard
Posts: 2
Joined: Wed Nov 04, 2009 6:55 pm

Re: web app to query csv file and display results

Post by mbernard » Wed Dec 02, 2009 7:30 pm

Thank you both for the response. Is there any way once you bring in the text into the table to suppress seeing it, and then allow a query against the file to then display the results.

Detail: The project is to take a CSV file with 6 fields, from the website, a user will enter a name, parcel, or address to search for their information, the info found will be displayed.

Any help would be appreciated.
Thanks!

Post Reply