Page 1 of 1

Datagrid

Posted: Tue Sep 11, 2018 3:56 pm
by Cowtrax2
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

Re: Datagrid

Posted: Tue Sep 11, 2018 4:11 pm
by Klaus
Hi Mike,

welcome to the forum!

Sorry, I don't understand your problem?


Best

Klaus

Re: Datagrid

Posted: Wed Sep 12, 2018 10:23 pm
by Cowtrax2
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

Re: Datagrid

Posted: Wed Sep 12, 2018 10:40 pm
by Klaus
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

Re: Datagrid

Posted: Wed Sep 12, 2018 11:40 pm
by Cowtrax2
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

Re: Datagrid

Posted: Thu Sep 13, 2018 3:44 am
by ghettocottage
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)

Re: Datagrid

Posted: Thu Sep 13, 2018 9:25 am
by Klaus
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

Re: Datagrid

Posted: Thu Sep 13, 2018 10:45 am
by SparkOut
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.

Re: Datagrid

Posted: Thu Sep 13, 2018 1:25 pm
by Cowtrax2
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