Datagrid

Creating desktop or client-server database solutions?

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
Cowtrax2
Posts: 4
Joined: Tue Sep 11, 2018 3:48 pm

Datagrid

Post by Cowtrax2 » Tue Sep 11, 2018 3:56 pm

i am working with a data grid.   when is have the grid
sorted by the primary key and then hilite the line to update the data, all is fine.  if i sort by another variable in the grid and select the line, the correct data is
not selected.  It selects the same data in the row from when it was sorted by key. I have tried things like dgDataOfLine or dgDataOfIndix as in the docs but it
does not put the correct information into my data array.  Any suggestions as what i might try?  Thanks.  Mike

Klaus
Posts: 10490
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Datagrid

Post by Klaus » Tue Sep 11, 2018 4:11 pm

Hi Mike,

welcome to the forum!

Sorry, I don't understand your problem?


Best

Klaus

Cowtrax2
Posts: 4
Joined: Tue Sep 11, 2018 3:48 pm

Re: Datagrid

Post by Cowtrax2 » Wed Sep 12, 2018 10:23 pm

Hi Klaus,

I have changed my tact a bit. Let me explain this. I have a scrolling field that i initially load from my sql table. I now want to sort this field by the second item and see the new sorted display on the screen. here is what i do that is not working:
put field "trips" into x
sort lines of x by item 2 of each
put "" into field "trips"
put x into field "trips"

this does not seem to change anything. I know this is different than my first post but i will get back to that after i can get this sort to work. I realize this is a simple task but i am just learning LC so i would appreciate any help you can give.

thanks.
Mike

Klaus
Posts: 10490
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Datagrid

Post by Klaus » Wed Sep 12, 2018 10:40 pm

Hi Mike,

OK, as far as I understand you are missing a line:

Code: Select all

...
put field "trips" into x

## I highly presume that your data is TAB delimited:
set itemdelimiter to TAB
##

sort lines of x by item 2 of each
put "" into field "trips"
put x into field "trips"
...
Hope I got it right! :D


Best

Klaus

Cowtrax2
Posts: 4
Joined: Tue Sep 11, 2018 3:48 pm

Re: Datagrid

Post by Cowtrax2 » Wed Sep 12, 2018 11:40 pm

Thanks Klaus,

That worked. Thanks for your help. One other thing. I am new to LC but have spent many years working with databases. My question to you is for your opinion on using SQL Yoga. In this first project i am using SQLite. I am very used to working with FileMaker and a relational database. From what i have read about SQL Yoga it has some more "straight forward" commands to access the database. Have you ever used it and if so, is it worth the time to learn it and use. Thanks.

Mike

ghettocottage
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 279
Joined: Tue Apr 10, 2012 9:18 am

Re: Datagrid

Post by ghettocottage » Thu Sep 13, 2018 3:44 am

In my opinion, your time would be better spent learning the following:
learning MySQL queries
setting up a MySQL server on a basic linux VPS
installing Livecode Server on that VPS, along with Apache2
write LC server scripts with all of your queries and then use Livecode Stacks to send coded requests to access those queries you have and get data back.

There is a learning curve, but once you get the hang of it all you will basically have all of the advantages of a Filemaker Server without the massive overhead involved in licensing fees and headaches of running a filemaker server (if you have ever been so lucky)

Klaus
Posts: 10490
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Datagrid

Post by Klaus » Thu Sep 13, 2018 9:25 am

Yes, I second that!

I never used SQLYoga, but learned some SQL, enough for working with SQLite and LC, here:
https://www.w3schools.com/sql/default.asp

Best

Klaus

SparkOut
Posts: 1827
Joined: Sun Sep 23, 2007 4:58 pm

Re: Datagrid

Post by SparkOut » Thu Sep 13, 2018 10:45 am

SQL Yoga is great, and provides a consistent method of dealing with SQL queries as well as some data validation, escaping and sanitisation. It does have its own syntax, but you will need to understand the native SQL to be able to use it.
There's nothing it can do that you couldn't roll your own. It might be worth it for you, but I would get familiar with the basic LC database library first, if not necessarily expert. Then you can decide whether to take the additional step of learning SQL Yoga too.

Cowtrax2
Posts: 4
Joined: Tue Sep 11, 2018 3:48 pm

Re: Datagrid

Post by Cowtrax2 » Thu Sep 13, 2018 1:25 pm

Thanks for yor advice. I will contine to learn the native LC first and then decide. One other question. Any suggestions on where to get some professional looking background and buttons to use in apps?
Thanks. Mike

Post Reply

Return to “Databases”