Filtrating data from db in livecode

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
totalnoob
Posts: 20
Joined: Tue Jul 02, 2013 10:40 am

Filtrating data from db in livecode

Post by totalnoob » Sat Oct 19, 2013 6:45 pm

Hi im creating app with movie mysql database and i need somehow filtrate movies etc when someone choose Drama 90> with Morgan Freeman it will show that movies.I know how to connect to mysql with livecode retrive data and stuff but really dont know how to make it work

Thanks

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Filtrating data from db in livecode

Post by bangkok » Sat Oct 19, 2013 8:52 pm

Trials and errors. Plus guidances on the web. That's the only way.

Basically you need to create a SELECT query, with the proper way -that is the SQL way- the "filters" you're talking about.

But it depends a lot of your columns structure.

-Genre : will it be a text column ? Or an integer that points to another table (join) ?

-Time : year only ? Or a precise date ?

-Actors : only the leading role ? A list ?

You have a gazillons of super web sites out there that teach SQL.

When you have a clearer view of how it works, and how you should organize your tables and your columns... then we can help you with some specific LiveCode question.

totalnoob
Posts: 20
Joined: Tue Jul 02, 2013 10:40 am

Re: Filtrating data from db in livecode

Post by totalnoob » Sat Oct 19, 2013 11:03 pm

i created this http://bayimg.com/labNDaaFb which is working i just need somehow connect buttons to it that will print out movies you know ?

icouto
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 92
Joined: Wed May 29, 2013 1:54 am

Re: Filtrating data from db in livecode

Post by icouto » Sun Oct 20, 2013 3:00 am

totalnoob wrote:i created this http://bayimg.com/labNDaaFb which is working i just need somehow connect buttons to it that will print out movies you know ?
It is a bit difficult to understand exactly what you're trying to do. The screenshot of your app's interface is nice, but it doesn't help much.

From what I see, you have a list of movie TITLES that you present to the user. Underneath that list you have placed a Search field, with 2 buttons: Search by Actor, and Search by Genre. I'm guessing, that you want the user to type something, and press one of the buttons. Depending on the button pressed, you would then perform the proper search - ie, give the user a list of films based either on the genre or the actor name they entered. Is that correct?

If so, in order for us to tell you how to search your database, we have to know how your database is setup. Do you have different tables for 'Movies', 'Actors' and 'Genres'? What fields do you have in each of these tables? How are the records from one table related to the other? We cannot give you guidance without the required information...

totalnoob
Posts: 20
Joined: Tue Jul 02, 2013 10:40 am

Re: Filtrating data from db in livecode

Post by totalnoob » Sun Oct 20, 2013 10:24 am

i want make fuction called ,,movie picker" :D there people will choose http://bayimg.com/JAbHCAAFc http://bayimg.com/jaBHFaAfC you know ? and it will show them movies by choosing parameters of the movie :D http://bayimg.com/jabhGAaFC

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Filtrating data from db in livecode

Post by Klaus » Sun Oct 20, 2013 11:44 am

Hi totalnoob (about time to leave this state! 8) ),

I'm afraid you cannot avoid to learn some SQL for your project!
This one got me started with SQL: http://www.w3schools.com/sql/default.asp


Best

Klaus

totalnoob
Posts: 20
Joined: Tue Jul 02, 2013 10:40 am

Re: Filtrating data from db in livecode

Post by totalnoob » Sun Oct 20, 2013 1:53 pm

i have idea
its there a way how to move data from datagrid to another datagrid on another card i have it grouped but its not working. there will be data grid on every card (invisible) and it will filtrate by movies by choosing categories and stuff and at the end it will show only that movies what you think ?
btw my code looks like

Code: Select all

on mouseUp
   global gConnectionID
get revDataFromQuery(tab, return, gConnectionID, "SELECT * FROM movies WHERE Genre LIKE '%" & Drama & "%'")
set the dgText of group "datagrid 1" to it
      go to next card
end mouseUp

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Filtrating data from db in livecode

Post by Klaus » Mon Oct 21, 2013 11:54 am

I think that using (hidden) datagrids for this is an unneccessary and ineffective hack with too much overhead 8)

No idea why you refuse to learn a BIT about SQL, waht you have in mind is a snap with SQL! :D

Post Reply