Page 1 of 2
Advice Needed
Posted: Tue Oct 14, 2014 2:35 am
by sadarahu
I'm especially interested in database type Applications. So far I was using B4A which is an excellent tool and it is growing fast. Tons of libraries, demos samples and great support forum. The only downside is that B4A can makes Apps for Android only. At this point I need to create Apps for multiple platforms, so I'm looking at the LC. My concern is working with SQLite and being able to create professional grids/forms. I have seen some examples here and there but so far the best I could see was editable grid, which is not enough for me to select LC. I'm looking for grids which can implement features like: sorting, filtering, sums, grouping etc. Moreover I need forms which allow Master/Detail (Parent/Child) related tables displayed. Of course due to the mobile limitation it is fine to show Master/Detail on separate screens (Tabs for example) but this functionality is crucial for me.
I would appreciate any professional input. By professionall I mean input from some one who did that, not from some one who hopes this or that works.
Thank you very much for any suggestions.
Arthur
PS>
I have also seen some external components which seem to offer some extra functionality but not sure about the details. One thing which is very confusing and should change is a terminology, where the FORM and GRID are called the same. I've seen the documents referring to GRID (while talking about form and vice-versa, but this is just my digression).
Re: Advice Needed
Posted: Tue Oct 14, 2014 10:04 am
by dave.kilroy
Hi Arthur and welcome to the forum
Yep it sounds like LiveCode will be able to do what you need - and the forum here is pretty good too
Here is a basic lesson on getting started with SQLite
http://lessons.runrev.com/s/lessons/m/4 ... e-database - for more on using SQLite from within LiveCode check out this 'SQLite sampler'
http://livecodeshare.runrev.com/stack/7 ... te-Sampler
For more on data grids (which can be setup with 'grid' or 'form' attributes) check out the 'Data grids tour'
http://livecodeshare.runrev.com/stack/7 ... Grids-Tour. A word of warning on data grids, they are very powerful but do have their complexities and can take time to use if you want to do more than simple stuff - so it may be worth considering whether a data grid is really needed and if a, for example, simple table will do instead.
There are of course lots of lessons about both these topics at
http://lessons.runrev.com
As regards master/detail arrangements, there are many ways to do this but I usually use a list field or datagrid for the 'parent' view and a bundle of fields/checkboxes etc for the 'child' view (which could of course be on a different tab on a mobile device).
Kind regards
Dave
Re: Advice Needed
Posted: Tue Oct 14, 2014 9:09 pm
by sadarahu
Yes Dave, thank you for your time and reply. I'm not a novice to the database development although I'm new to LC. I was able to create a Master/Detail from/grid type of functionality on Android, and as you have said because of small screen and other limitations the "parent data" (usually the header form was placed on one screen as form, while the child records (as grid/list) placed on the Tab. This is also probably the most convenient solution for the user. I would really appreciate if you could point me out to any existing example which shows how the Parent/Child relationship is done. Personally I prefer to use the separate terms for Grid and Form (so it is not confusing) and I don't understand why the both objects are placed on the toolbar as one (with the MODE dropdown) - this is confusing and not very logic (to me) but perhaps I'm still missing something.
If I'm not mistaken I have seen some add-ons allowing speeding up data manipulation and organization. I wonder if any of those externals are really helpful and worth the price tag. One other thing I would like to ask is how easy can I implement data synchronization with existing MySQL server. I have a need to work on/off-line on a device then do manual (bi-directional) updates. Since I'm using shared hosting I do not think I would be able to install any LC libraries on the server, so the question is if there are any other tools or libraries provided to help implement syncing ?
Three extra quick question:
- Are there any tools or functionality to create multilanguage Apps (i.e. user can select interface language on the fly, or at list upon installation). ?
- Is it possible to develop off-line (when needed) ?
- Does LC take care of device screen sizes automatically (or I need to code in this functionality) ?
The forum looks good, lots of activity and lots of value so generally the whole framework looks really good and powerful.
I would also like to express my applause for all documentation that is available and well done. Unlike many other systems LC seem to be much better documented than other platforms which is a big plus! So far I really like it.
Re: Advice Needed
Posted: Wed Oct 15, 2014 10:29 am
by dave.kilroy
Hi Arthur
The data grid has got two sides to it - Dr Jekyll is the 'grid' and is very similar to a spreadsheet - Mr Hyde is the 'form' is a row-based list which can present data in a different way - they are both great and (and tricky) there is no illogicality - think of the datagrid as a convertible car - sometimes with the top down and sometimes with the roof up...
As regards parent/child examples, the following image is from something I did a while ago showing 3 levels (grandparent,parent,grandchild) - the drop-down control allows a user to select a main section, the little datagrid on the left shows the names of subsections within a main section (could have used a simple table, can't remember why I used a datagrid), and the fields and buttons on the right display all elements for that subsection along with buttons to edit, add new etc:
With LiveCode I was able to organise code in such a way that a single call would populate the 'header' data on each section, and a different single call would populate the 'grandchild' part of the screen dynamically with various fields and buttons as relevant to that particular sub-section
This is all saved locally to a SQLite db and I used two free LiveCode libraries from other developers (thanks Guglielmo Braguglia and the late Mark Smith) to manage connecting to Dropbox and handle JSON data.
It is also easy to set up a web service using LiveCode server to make an app on a mobile device communicate with a remote database - and if you can modularise your code correctly with connect-to-SQLite and connect-to-MSQL components then much of the code could be the same whether working with local or remote database.
I've never set up a web service making use of .php but lots of others here on the form have and will be able to advise you...
I've done manual or on-startup syncing setups between remote and local data and my experience has been that it is all very doable over multiple platforms but is just involved (so far I've used manifest systems to keep tally of what needs syncing...)
Good luck!
Dave
Re: Advice Needed
Posted: Wed Oct 15, 2014 5:47 pm
by sadarahu
Dave - I really appreciate your answer and hope this will help many others starting with LC to understand the benefits and potential culprits.
Your screen looks pretty god although it seems to be designed for tablets. I wonder how the screen organization works depending on device size. Is there any function or mechanism which resizes the objects and controls on the screen based on device screen size or this has to be programmed manually (or you just keep different versions for each device).
Form what you say there is no "per-se' particular FORM object and I wonder what was the reason to create GRID-form (mode) instead placing a separate (Form) object in the toolbox. Seeing the form with rows is completely new concept to most people (and I have to admit a bit confusing). By looking at your example and many others I'm sure forms can be implemented into LC projects, but I'm also concerned how quick this can be done and what is the learning curve.
Would you by any chance be able to share your project as an example to see how this is done (or perhaps point me to some examples which specifically show how to implement GRID -> FORM schema) ?
When looking at the toolbox I also do not see the TAB object/control and I wonder if one can implement Tabs without extra add-ons (like MobBUI).
Have you ever managed to place Parent/Child record information using Tabs ?
Arthur
Re: Advice Needed
Posted: Sat Oct 18, 2014 11:41 am
by dave.kilroy
Hi Arthur
I've just sent you a direct message suggesting the best way to get you up to speed might be via a real-time chat on Skype...
Kind regards
Dave
Re: Advice Needed
Posted: Tue Oct 21, 2014 12:40 am
by sadarahu
Thank you Dave, it is kind of hard for me to get on Skype because I'm on very unpredictable schedule, but perhaps will give a try (just need few more extra days). In the meantime....
Today I looked up briefly a tutorial about the Grid/For and I have to say I a bit disappointed with the fact the the standard meaning of the GRID and FORM is very different from what LC presents in the DOCS. I really do not understand the reason for that and it is very confusing. Whenever I see any documentation referring to FORM immediately in my mind I see a screen with data entry fields and some form of SUBMIT button. This has been a standard for years. In LC it seems like Grid mode and Form mode are the same. I'm sure there are some differences but the concept is so different from everything else I've used in the past that it is confusing and seems hard to grasp. I was looking for some example of the form in that tutorial page but when looking at the FROM section there was again grid presented with some other extra features, so I think this concept is a big miss in sense of terminology.
I would really like to see a FROM control on in the toolbox where I can place a Form control on a card the place data entry controls on the form frame object. I was also disappointed not being able to find a real FROM example. I would appreciate if you could point me to some right direction and example so I can study this in my free time.
Thanks - Arthur
Re: Advice Needed
Posted: Tue Oct 21, 2014 2:01 am
by dave.kilroy
Ah you're thinking of 'form' as in the HTML sense of the word and hence your disappointment and confusion.
Datagrids are a completely different kind of animal from HTML pages and have nothing whatsoever to do with 'forms' from the HTML world. Better to think of them as fancy worksheets (from a spreadsheet) that come in two styles, 'grid' (with columns) and 'form' (no columns but fancy formatting)
Re: Advice Needed
Posted: Tue Oct 21, 2014 3:13 am
by Simon
Hi Arthur,
If Dave is correct then you just drag fields onto a card and make your form 1 field at a time.
It would actually be 2 fields for each question.
1) a label field, this would not be editable by the end user and would contain the question.
2) a text entry field, where they actually type in their answers.
Really easy to set up how ever you like.
Simon
Re: Advice Needed
Posted: Wed Oct 22, 2014 6:35 am
by sadarahu
Yes I understand your point and the fact the mobile forms are not HTML forms, however while working with B4A I was able to create regular forms by placing form objects on the screen. The you all for your replies, however I still did not get any links to get a simple example of using form linked to some database. Another words perhaps if I would see it in action it would be much easier to grasp the concept. I have seen a grid and (I would call it) "Editable Grid" (while it is called Grid in form mode in LC - personally I do not like this terminology), but not a from.
I want to see the example which shows dB data on the list, and the from (placed on another screen) so when user decides to edit a record he can update data on the from, save it, then come back to the grid. This is a standard behavior and I'm little disappointed I cannot find it.
Would be also nice to play with some kind of Parent/Child example. So far I hear it is possible but cannot find one sample App.
Thank you
Arthur
Re: Advice Needed
Posted: Wed Oct 22, 2014 6:39 am
by sadarahu
Simon wrote:Hi Arthur,
If Dave is correct then you just drag fields onto a card and make your form 1 field at a time.
It would actually be 2 fields for each question.
1) a label field, this would not be editable by the end user and would contain the question.
2) a text entry field, where they actually type in their answers.
Simon
yes this part is simple, but I would like to see how the data manipulation is handled ?
How the records are retrieved from relational tables ? I see no dropdown list object (I believe it is called Spinner) - so how is this handled ?
How the data is passed between activities (cards) ? do I need to use global variables or some other method.
How the filed validation is managed ? etc. So I'm hoping all this is possible, but the downside is that I see not tutorials or better yet example Apps
Art
Re: Advice Needed
Posted: Wed Oct 22, 2014 7:09 am
by Simon
Hi Art,
There aren't examples because this is part of being a programmer.
Here is your database:
http://lessons.runrev.com/m/4071/l/3051 ... e-database
Here is the Spinner:
http://forums.livecode.com/phpBB2/viewt ... =49&t=6005
The rest is simple stuff... Yeah use globals if you like, there are custom properties as well which work really well.
Validation... hmmm up to you:
repeat with x = 1 to the number of char in fld 1
if char x of fld 1 not isNumber then
answer "Numbers only in this field"
end if
end repeat
Simon
Re: Advice Needed
Posted: Thu Oct 30, 2014 2:35 am
by sadarahu
There aren't examples because this is part of being a programmer.
this sounds like a poor joke
I worked with other tools and there are plenty of grid/form examples, so saying "this is the way it is because you're programmer" makes no sense to me and is very discouraging.
Thanks for the links but I have already seen those. I was asking for sample App which simply shows GRID with the records along with editable FORM when I can simply do CRUD operation. So far given examples do not show what is most important for beginner (although show how to create a table) which is really low priority because building an SQL script to create a table is not part of LC (rather SQL) so I do not understand why waste time for such tutorials while major tasks are not explained.
Every database project relies heavily on GRID and FORM, those two elements are crucial and if not documented properly will make people to steer in another(wrong) direction or have them look for other tools. Not being able to find enough resources on this topic is a big disappointment for me (As I was initially very excited about LC),..
Arthur
Re: Advice Needed
Posted: Thu Oct 30, 2014 2:44 am
by Simon
Hi Arthur,
Do you have an example of what you'd like to build?
screenshot/webpage?
I'll see if I can get you started.
Simon
Re: Advice Needed
Posted: Thu Oct 30, 2014 4:44 am
by sadarahu
Yes, it can start with something simple. Just one table (say contacts) for mobile phone based on (existing) SQLite. No need for creation script (this was already covered).
TABLE(Contacts)
ID, INT(7)
FirstName, VCHAR(20)
LastName, VCHAR(30)
Phone, (VCHAR(12)
GRID showing records with 1 button
ADD NEW (contact)
CLICK/tap event to edit contact details on the form
FORM with 3 fields to enter data
Buttons: DELETE, SAVE to save record and go back to the grid after saving or just SAVE.
That should be a god head start for beginners, then few more advanced topic could be added in the next level (i.e sorting grid, displaying user details on the "read only" form, adding image to the grid/form etc.)
This is probably the most common scenario.
Art