List Definition

Vik Shah Vik at Keys2Solutions.com.au
Wed Aug 1 18:38:37 EDT 2018


Just wanted to add to this conversation.

There is probably one (not so smart) way around this issue. I’d create a list with my set definitions as a string and store that in the $userinfo of the file class. Then whenever I want to access “definition #3”, I just get the list of definitions, goto that line #3 and pull out the definition string from the $userinfo and define away…

:-)

Regards,

Vik Shah


> On 2 Aug 2018, at 01:51, Michael Mantkowski <michaelj at clientrax.com> wrote:
> 
> To a degree, I agree... lol
> 
> But, "Explicit" is not always faster.
> 
> If you are working with a large number of fields in a looping method these things can become noticeable.  Example being what I was working on when our current system was taking .5 seconds to bring up a new page and almost 8 seconds for the new method.  All traced down to this one command.
> 
> Yikes!
> 
> It looks like Omnis is going to give us a little help on this issue, so it may all be moot now.  But always fun to have an interesting discussion on better ways to code.
> 
> *********************************************************************
> Michael Mantkowski
> ClienTrax Software
> 1-614-875-2245
> *********************************************************************
> 
> 
> -----Original Message-----
> From: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> On Behalf Of Doug Easterbrook
> Sent: Wednesday, August 1, 2018 11:35 AM
> To: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
> Subject: Re: List Definition
> 
> so,  ouch.   I’m just trying to thing of ways that may be out of box.
> 
> 
> there is a maxim in python ..   make things explicit.   and since you’ll be using table classes in the future, brobably the best way to cleat things is to have an explicit method and a generic OO type function call.  it will save you grief — and forget about clear range of fields.  its not gonig tro work in the future anyway.
> 
> so code might be
> 
> Begin reversible block
>   Set main file {TRANSAC}
>   Set current list lvList
> End reversible block
> 
> do $cinst.$clearFields
> 
> 
> 
> and in $cinst.$clearFields
> 
> calculate field 1 as ‘'
> calculate field2 as 0
> calculate field3 as emptyDate
> etc.
> 
> 
> its very explicit and does not matter about the order of the fields in a file, schema or query class.
> nor does it affect you if you put a new field in the middle of the range of fields in a file class so ti gets cleared inadvertently.
> 
> 
> 
> 
> just my opinion…    explicit coding is better tan implicit … and safer.
> 
> 
> 
> 
> 
> 
> Doug Easterbrook
> Arts Management Systems Ltd.
> mailto:doug at artsman.com
> http://www.artsman.com
> Phone (403) 650-1978
> 
>> On Aug 1, 2018, at 6:38 AM, Michael Mantkowski <michaelj at clientrax.com> wrote:
>> 
>> Sort of.  But in its simplest form you can forget about saving 
>> anything to disk.  (But to answer your question...  Not using Table 
>> Classes yet but will move that way in the future most likely.  This is 
>> a way to give those of use with large applications the ability to use 
>> SQL databases when we do not have the resources to rewrite the whole 
>> application.)
>> 
>> Clear range of fields is handy when you want to clear out a subset of a file class for whatever reason and retain the rest of the current values.  For instance, in our Medical Record file I may wish to clear all the fields that are associated with Lab Results but leave the rest as they are.
>> 
>> Of course, this only works if you had given forethought in your database design and all those fields are consecutive.
>> 
>> It is even more handy in a reversable block as you can create and save multiple records over and over and then easily return the cleared rage of values to the original values.
>> 
>> Finally, you and also use it to clear the whole file when you do not wish Omnis to reread the record from disk after a reversable block like "Clear Selected Files" does.
>> 
>> So, I can replicate the behavior fairly easy using something like below, but it is much easier to just put in a "Clear range of fields" in the reversable block.  The below was what I was going to try and replicate in the interception method for "Clear range of fields" but if we cannot define the list with parameters I can't do it.  The first "Add line to list" stores the current CRB.  The second allows me to quickly clear all the values in the CRB that are included in the list.  Then I can restore them at the end of the method.  But who wants to write all this code every time I want to use "Clear range of fields"?
>> 
>> Begin reversible block
>>   Set main file {TRANSAC}
>>   Set current list lvList
>> End reversible block
>> 
>> ;  Temporarily Clear Fields needed for List.
>> Do code method CodeClass/Define Invoice Items Add line to list Add 
>> line to list 
>> {('','','','','','','','','','','','','','','','','','','','','','',''
>> ,'','','','','','','','','','','','','','','','','','','','','','','',
>> '','','','','','','','','','','','','','')}
>> Load from list {2}
>> 
>> ; Do other stuff
>> 
>> ;  Set Fields back to where they were.
>> Set current list lvList
>> Load from list {1}
>> 
>> *********************************************************************
>> Michael Mantkowski
>> ClienTrax Software
>> 1-614-875-2245
>> *********************************************************************
>> 
>> 
>> -----Original Message-----
>> From: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> On Behalf 
>> Of Doug Easterbrook
>> Sent: Wednesday, August 1, 2018 9:14 AM
>> To: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
>> Subject: Re: List Definition
>> 
>> I know I’m wading into something you’ve thought  (or fought) for a long time..   so, all I can do is ask questions..
>> 
>> 
>> I use (as in still  use, even though we are totally postgres SQL)  clear range of fields to get stuff out of the CRB — its very handy.  sometimes its clear files - that works too.
>> 
>> 
>> but.. if I understand you are trying to have two methods to writ to the database, one for DML and the other for SQL.
>> 
>> is your situation like
>> 
>> 
>> give some fields in the CRB a value
>> save those into a temporary place
>> 
>> 
>> then somewhat along the way …
>> 
>> if DML
>> set main file [filename]
>> Prepare for edit
>> copy fields into CRB from temp place
>> update fields
>> 
>> Else (must be SQL)
>> make a sql statement to update files
>> 
>> end
>> 
>> 
>> 
>> and are you using table classes, or not?
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> Doug Easterbrook
>> Arts Management Systems Ltd.
>> mailto:doug at artsman.com
>> http://www.artsman.com
>> Phone (403) 650-1978
>> 
>>> On Aug 1, 2018, at 6:05 AM, Michael Mantkowski <michaelj at clientrax.com> wrote:
>>> 
>>> Hi Doug,
>>> 
>>> Yes, that is the correct intent.
>>> 
>>> The reason this is coming up is because we are working on a module that will allow the standard DML commands to work with SQL.  So, in this case the CRB is still in play.  We are working with Omnis on this and it may be that "Clear range of fields" should not even be intercepted by this module and should just be left alone.  But at this point is it is being intercepted so we are trying to replicate the correct behavior in the most efficient way.
>>> 
>>> *********************************************************************
>>> Michael Mantkowski
>>> ClienTrax Software
>>> 1-614-875-2245
>>> *********************************************************************
>>> 
>>> 
>>> -----Original Message-----
>>> From: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> On Behalf 
>>> Of Doug Easterbrook
>>> Sent: Wednesday, August 1, 2018 8:40 AM
>>> To: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
>>> Subject: Re: List Definition
>>> 
>>> so, if I understand the problem
>>> 
>>> you are using the following in a procedure
>>> 
>>> begin reversible block
>>> clear range of fields  a to b
>>> end reversible block
>>> 
>>> 
>>> to basically return all variables in the range of fields to their original value after messing around with them in the method???   is that the intent?
>>> 
>>> 
>>> in DML — clear range of fields works fast because its the current record bufffer you are playing with.    it also works on had variables.
>>> 
>>> 
>>> in sql…  you likely haven't loaded the data into the current record buffer, so the values are already in the line in the list — so you might be able to copy things to a row variable and return that to the list afterwards using    $assign()
>>> 
>>> or, copy the data into a temporary row and operate on that row.
>>> 
>>> or.. use $loadcols to load the data from a list row into memory and then use the clear range of fields.   the original line in the list should not be touched.
>>> 
>>> 
>>> 
>>> its the end goal or purpose  thats confusing .. I’m only hearing ’save variables.’     and that notion doesn’t really apply when things are in a list.    meaning it sounds like you are refactoring your code at the moment to use SQL — and so you need to know that it doesn’t use the CRB which is primarily what the clear range of fields works on.
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Doug Easterbrook
>>> Arts Management Systems Ltd.
>>> mailto:doug at artsman.com
>>> http://www.artsman.com
>>> Phone (403) 650-1978
>>> 
>>>> On Aug 1, 2018, at 5:18 AM, Michael Mantkowski <michaelj at clientrax.com> wrote:
>>>> 
>>>> Hi Michael and Kelly,
>>>> 
>>>> Thanks for those ideas.  We have been down those roads already and 
>>>> they work, but I am looking for a faster method.
>>>> 
>>>> We are working on some SQL / DML compatibility things for the 
>>>> upcoming Omnis 9.  We are trying to find a fast way to replicate the 
>>>> "Clear Range of Fields" command in Omnis.  We have tried a few 
>>>> methods but so far, they are far slower than the standard DML 
>>>> command.  It is causing a huge performance issue in out Medical 
>>>> Records module.  In DML mode it is taking approximately
>>>> .5 seconds to move from page to page.  When we switch to SQL it was 
>>>> taking 7
>>>> - 8 seconds which is totally unacceptable.  Traced it down to heavy 
>>>> use of Clear Range if fields in reversable blocks.
>>>> 
>>>> We have improved it so that it is only taking about 3 seconds now 
>>>> but that is still way off for what I am looking for.  My idea was to 
>>>> define the list to the range of fields I am looking for, save the 
>>>> values in the list, add a second line to the list of all clear 
>>>> values then do a load from list to clear the CRM values of only 
>>>> those fields in the range.  Then if it was in a reversable block we 
>>>> could just load line 1 of the list again to bring back the original values.
>>>> 
>>>> It also has to work with Hash Variables as well.  That is why I was 
>>>> looking to use square bracket redirection.  I still think it might 
>>>> be a bug that that does not work with lists.  Can't see why it shouldn't anyway.
>>>> 
>>>> Currently we are building a list of values by looking up the File 
>>>> Class and searching them out and looping through as Michael suggested.
>>>> It just takes time.
>>>> 
>>>> I could Implement this all manually in the locations I need it on my 
>>>> medical record if I can't figure out a way to do what I am looking 
>>>> for.  But would rather have a snappy piece of reusable code that 
>>>> will work for all current and future "Clear range of fields" needs.
>>>> 
>>>> ********************************************************************
>>>> *
>>>> Michael Mantkowski
>>>> ClienTrax Software
>>>> 1-614-875-2245
>>>> ********************************************************************
>>>> *
>>>> 
>>>> 
>>>> -----Original Message-----
>>>> From: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> On 
>>>> Behalf Of Kelly Burgess
>>>> Sent: Tuesday, July 31, 2018 7:58 PM
>>>> To: OmnisList <omnisdev-en at lists.omnis-dev.com>
>>>> Subject: Re: List Definition
>>>> 
>>>> The way to use indirection with list.$define() is
>>>> 
>>>> Calculate define as con("$define(",fld1,',',fld2,',',fld3,')')    or
>>>> con("$define('",fileClass,"')")
>>>> Do myList.[define]
>>>> 
>>>> Kelly
>>>> _____________________________________________________________
>>>> Manage your list subscriptions at http://lists.omnis-dev.com Start a 
>>>> new message -> mailto:omnisdev-en at lists.omnis-dev.com
>>>> 
>>>> _____________________________________________________________
>>>> Manage your list subscriptions at http://lists.omnis-dev.com Start a 
>>>> new message -> mailto:omnisdev-en at lists.omnis-dev.com
>>> 
>>> 
>>> _____________________________________________________________
>>> Manage your list subscriptions at http://lists.omnis-dev.com Start a 
>>> new message -> mailto:omnisdev-en at lists.omnis-dev.com
>> 
>> 
>> _____________________________________________________________
>> Manage your list subscriptions at http://lists.omnis-dev.com Start a 
>> new message -> mailto:omnisdev-en at lists.omnis-dev.com
> 
> 
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 






More information about the omnisdev-en mailing list