List lines all same, the code
Hi Kelly and everyone,
Thank you for reading.
I thought that someone would know what makes a list go all lines same values.. without giving my details but I was wrong, so here are the details.
Problem: On making list it looks good, all lines have different data as they should, then it is saved in SQLite and this is Omnis latest version 10.2, using save code I am using for everything else and lists are saved correctly, then I retrieve the record or row and display it in the same headed list box it looked good in a second ago and now all lines have the same data in them, equal to what was the last row in the list, I’m losing the lines of the list
Latest upgrade of 10.2 which I’m now using did not solve this problem.
In prose: There is a SQL table called fcListBucket in which I store lists, random ones, each record has a different list definition in it is the result.. lists I need to build windows for example, that is this case, I am capturing the field placement details top, left, height, width, in a list, and saving that in a table, then retrieving it just to check it, using a headed list box with a simple definition, ttype, ttop, tleft, theight, twidth
Later I’ll use that to place fields when certain options are chosen
The list bucket schema only has a few fields
Lbrsn (primary key)
Lbname (the unique name I give this list, this is my find on field)
Lblist (list bucket list)
So I name it and put a list in the list field then save, retrieve, view, delete if incorrect
I am directly building my list in that MOFF field and then transferring that to a SQL row via calculation field by field to make the row, all of which I’ll show, and saving that SQL row to the table.. this is working for all my tables and methods in an app that is being used by people.. it is working, I never have problems with lists and I know how to do them, as you’ll see I think
This is the load code for example, the one for lines I’ve drawn
On evClick
Do $cwind.$bobjs.$makelist($ref.$objtype,$ref.$top,$ref.$left,$ref.$height,$ref.$width) Returns lblist
Do fcListBucket.lblist.$redefine(ttype,ttop,tleft,theight,twidth)
Do fcListBucket.lblist.$search($ref.ttype=’line’)
Do fcListBucket.lblist.$remove(kListKeepSelected)
Calculate lbname as ‘SouthernTransitsLines2’
Calculate lbidentifier as ”
Calculate lisbukrsn as #NULL
Do $cinst.$redraw()
Upon clicking the button to run the above code a list of my lines appears correctly I recognize my data in this case, the list appears correctly the lines positions are shown to me in a headed list box
This is my Save button code
On evClick
Do tvO.$updatefile(‘fcListBucket’,’ADD’)
The reocord gets saved, I check on it using the Omnis provided “Show Data” in the browser window.. the records are appearing in that list with the correct names. I retrieve them, they are incorrect, and I delete them, and they leave that list.. so the records are saving, retrieving and deleting as they should, only the list is blown away somehow from time of clicking save button to retrieving for display.
This is my retrieve the record code
On evClick
Do tvO.$singlefilefind(lbname,’SouthernTransitsLines2′)
Do $cinst.$redraw()
The two object class methods called in the above code are proved to work for records such as these, containing a find field and a list, I do this kind of thing all the time with no problems, it’s just today and just this list.. it’s a fluke.. so it would seem
The reason for making the field #NULL is a SQLite thing about primary key fields when they are being added to the table
The code behind the two called methods $updatefile and $singlefilefind are large.. it’s a good bit of code to do everything there is to do about saving a MOFF held record to a SQL Table.. so I hesitate to show the code behind those two methods.. they’re so proven too already..
> On Mar 2, 2021, at 2:05 PM, Kelly Burgess <kellyb@montana.com> wrote:
>
> Hi Das,
>
> Your post is too vague to suggest any possibilities. You say ‘no code going on’ but no code, no list, so there must be code. You say you’re saving and retrieving the list – saving where and how? If you show us a dozen lines of code, maybe we’d see something to suggest.
>
> Kelly
_____________________________________________________________
Manage your list subscriptions at lists.omnis-dev.com
Start a new message -> mailto:omnisdev-en@lists.omnis-dev.com