Page Index Toggle Pages: [1] 2  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) Globalvalue (Read 3826 times)
proudpoppy
Full Member
Members
***
Offline


Do What ??

Posts: 420
Location: South Carolina
Joined: Apr 7th, 2004
Globalvalue
Aug 4th, 2004 at 7:54pm
Print Post Print Post  
On Page 54 of the programming guide it explains how to use the globalvalue & @globalvalue, but how would you set the initial globalvalue say my database has existing records and I needed to start at 1518 and increment from there?I tried what was in the book but it would start out with #1 each time and increment from there. After several hours I got it to work but I'm sure there is a easier way of doing it.    ??? The statement below the example says it will increment it if existing, but it didnot work for me. Any Idea's much appreciated.
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Globalvalue
Reply #1 - Aug 4th, 2004 at 8:06pm
Print Post Print Post  
Hello proudpoppy,

To initialize the GlobalValue just run a single record Mass Update with the following code.
Code
Select All
GlobalValue("NextCustRecNo", @Str(1518))
 


What did not work for you?
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
proudpoppy
Full Member
Members
***
Offline


Do What ??

Posts: 420
Location: South Carolina
Joined: Apr 7th, 2004
Re: Globalvalue
Reply #2 - Aug 4th, 2004 at 8:23pm
Print Post Print Post  
The guide states that if the "number" already exist that the code on page 54 will increment it by one, my databases are coming from Q & A and have existing incremental number fields in them, but after I put the code in a element (field) it would increment, but it would begin with the number "1" and increment from there not from the last value in that field which was 1518, The code on page 54 line #3 has "Globalvalue("nextrecordnumber", recNo) which I changed "RecNo to 1517 and reconciled then added a record, then went back into Sdesigner and changed it back to RecNo and after that it was incrementing right.But I was sure there had to be a easier way of incrementing it from 1517 then the way I did it.    Grin
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Globalvalue
Reply #3 - Aug 4th, 2004 at 8:43pm
Print Post Print Post  
Proudpoppy,

Run the code in a Mass Update to set it the first time. Retrieve one record and run a Mass Update that sets the starting number. You don't need to save the Mass Update or ever run it again. You do, however, want to run the Mass Update from Preview in Designer to get it into the dsr. Otherwise, your Global Value will be reset when you Reconcile.

If you are using Global Values, you should be aware that Reconcile will reset them to the current values in the dsr. Before making design changes, you should make a new dsr out of your db so you have these values.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Globalvalue
Reply #4 - Aug 4th, 2004 at 9:44pm
Print Post Print Post  
Please tell me that I am misunderstanding this.

This would seem to eliminate (or make more cumbersome) the ability of developers to make design changes while users are using the application.

As a developer you are saying that I cannot make design changes over a few days/wkkes and then go to my client's system and reconcile with the current database.  Instead, I must get a copy of the current database.  Make a DSR.  Tell my client not to use the database until my design changes are done.

I thought that one of the features of Sesame was the ability to design independently of the users activities.

So perhaps what we need is some type of checklist of things to be done with a new design brought to a client:

Is seems like something like this rough outline will need to happen:

1.  Get a list of all the Global Values in all of the forms in the application DAT. 
2.  Get a list of the current values of all of those GlobalValues.
3.  Do  a  Mass Update to the DSR to set the values in the DSR to the current values in the DAT.
4.  Now do the Reconcile of the DSR to the DAT.
==============================
I already had notes that Retreive Specs, etc. will be lost in the DAT and replaced by those in the DSR, so I have already been dealing with those manually.  I had already made a note the @NUMBER would be lost with reconcile.  I have been accumulating various notes like this from the very beginning, but doubt if I have a handle on all of them.  I feel fortunate that I have been involved from the beginning, and wonder about those newcomers who will not have the time to go back and read every posting on this forum to pick up those types of warnings.

This is becoming more awkward to support designs separate from end users.  Could you please provide a checklist like the one I sketched out above, detailing what steps must be taken, in what order, to properly reconcile a DSR with a DAT that will not lose any of the Saved Specs, GlobalValues, @Number values, etc. 

I don't think that there is any such list anywhere, and as more applications are being made with real data, the risk of corrupting data needs to be minimized.

The potential data loss/corruption issues may be obvious to those in the development group, but I don't think that they are obvious to all of us in the trenches. 

  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Globalvalue
Reply #5 - Aug 5th, 2004 at 3:37am
Print Post Print Post  
Bob, I completely agree with you.

Currently I have a sticky note that I stick on the wall next to my desk whenever I am 'designing' and anything a user saved in the Spec Manager in the DB will be lost when I reconcile.

Its very confusing and cumbersome. Its just a matter of time before someone loses something of importance.

Hopefully there will be a solution soon.

Steve
  
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Globalvalue
Reply #6 - Aug 5th, 2004 at 10:53am
Print Post Print Post  
What you need to do depends on what your application does. If your runtime programming does not change the Global Values, then you don't need to worry about it.  If it does, then you need to take that into account.

We are looking into adding some options to reconcile to preserve global values, @number settings, etc.

  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Globalvalue
Reply #7 - Aug 5th, 2004 at 1:01pm
Print Post Print Post  
As Erika stated, we are going to put an option in reconcile to either reset or retain reconciled values. The problem (looking into the future) with this approach is that it will still only cover a portion of what people are trying to do at any given moment. Today we have users who always want to reset all their Global Values, and we have users that always want to retain all their Global Values. But as designs progress, we will have more and more users that will wish to retain some, reset others, delete and recreate still more.

The two current "camps" depend on whether your way of working is driven by the .db/.dat file or the .dsr/.ddt combination. Some people keep the .db/.dat files - not the .dsr/.ddt and always regenerate .dsr/.ddt before making design changes. Others do the reverse. There are a number of designs that use the GlobalValues as a kind of ongoing lookup. Others *need* to have them reset as part of a design change. I have an application that uses the GlobalValues as derived from the Zip Code database, replacing it completely. The number of variations of use is endless. For those that are using Global Values simply as a @number replacement, and the numbers generated are contininous and ongoing, then yes - it is necessary to derive those numbers from the running .db file. A simple one record mass update will do the trick before a reconcile.

In the long run, it comes down to how much control you want. The way it works now, the value of a Global Value is applied at design time by the designer of the application. If it were always derived from the .db at reconcile it would always be decided by the actions of end user (appropriate in the @number case (given there have no mistakes on their part), but not  many others), if it were a single setting: "retain Global Values" at reconcile, then the question would be: "which Global Values" because some might be altered or reset at design time, and runtime Global Values would begin to inappropriately accumulate. The complaint would become that there is no way to reset the value, as opposed to it being "cumbersome" to retain the value. Additionally, if we offer to let you set/reset them one by one at design time, we certainly limit the extremely useful option of having many thousands of them, in that it would be extremely cumbersome to have reset or retain them individually were there more than a few. They would have to be "classed" upon creation: some being reset at redeploy, others being retained at redeploy. Or, by some means, queried and grouped.

Looking a few steps further down the road, the most flexible solution is to provide yourself with a simple mass update that derives any ongoing Global Values from the fields driven thereby, and use that mass update either before a reconcile, or after, depending on requirement. That way you have a flexible means, that adapts to the design addition of a further Global Values, that can selectively reset or retain values, that is far less cumbersome than a (possibly) lengthy dialog box with at a bare minimum of one button and one text box per GV.

By being a mass update, it can easily be checked for correctness and completeness, can easily be undone, should there be a mistake, can be printed, retained, edited in a text editor, and supplied to end customers, without sacrificing design control. And, given, that these would not change with every design change, this program only need be written once, checked for correctness once, as opposed to redecided every time a reconcile is invoked.

So while this solution does require that the application programmer have some programing skills, these must already be present for Global Value use in the first place. A less flexible, but more structured solution is to use "data driven" programming. That would mean checking the Global Value before use for a "reset value" that indicates that the Global Value needs to be rederived before use (if appropriate). That approach (in general) guarantees correctness. It does mean that you have to have the discipline when writing code to check for initialization before use. But given that we (Lantica developers) cannot tell if your application falls in the "reset camp" or the "retain camp" or in the ever-growing "mix-n-match camp", such an approach is probably worth the additional effort to adopt. It will make your application easier to maintain, more flexible, and more deployable.

Afterall, there are many uses for Global Values:

1. A retained value that can be altered at runtime
2. A communications channel across users and across time
3. A logging mechanism
4. A unique number generator
5. A field supplement
6. A static/dynamic lookup table
7. A simple lingual translator
8. A generational marker or tag
9. A copy control mechanism
10. A secondary security scheme
11. A replacement for "hard coded" values in SBasic
12. A multilayer undo
13. Result set retention
14. Legal shell command contents (offer choices, but *all* choices)

etc....

Some of these wouild benefit from a reset, others would want to be retained. Some are so dynamic it hardly matters.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Globalvalue
Reply #8 - Aug 5th, 2004 at 2:35pm
Print Post Print Post  
It seems like there are different issues to contend with if you are supporting an application for other users as opposed to just using Sesame for your own needs. I guess the term developer can describe any of us users (big or small) that have a need to enhance the application offline and then reconcile with an ongoing application.

Maybe there needs to be a breakout group at the October conference to discuss issues such as supporting an application. Sort of  a developers needs to do group. This can be either part of the breakout session allotted by Lantica or an unofficial gathering after or before the start of sessions for those who desire to discuss these type of issues.

Any opinions or thoughts?

Any objections from Lanticans?

  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Globalvalue
Reply #9 - Aug 5th, 2004 at 2:59pm
Print Post Print Post  
Quote:
Any objections from Lanticans?


Objections? Of course not. We'd be interested to hear what you come up with.

Just as a side note, the next release will have some new features that should make you developer-types pretty excited... 8) Grin
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Globalvalue
Reply #10 - Aug 5th, 2004 at 3:25pm
Print Post Print Post  
OOOH, any hints, clues, or release ETA's?

Steve
  
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Globalvalue
Reply #11 - Aug 5th, 2004 at 3:58pm
Print Post Print Post  
I would not be surprised to find that MOST design changes will not be done while the users are stopped from using the application.  Data entry will continue and the changes will be made on a DSR until it is convenient to do another Reconcile.   (Since 78.3% of all statistics are made up, then I cannot defend the use of MOST, but do feel comfortable that I may be correct).

And then we have the poor individual (self designer/ outside developer) who has no personal history of how/why these are used in a particular application.  The internal self designer is on vacation, or leaves and is replaced.  Or the outside developer inherits an application was originally designed by someone else.  Worse, that someone else is not available for helping. 
How do they make the decisions about what should be reset and what should not be reset? How to do a correct Reconcile?

And let's not forget that most of the discussion today is about Global Values, but we still have the issue of different Saved Specs in the DAT and the DSR versions.

Even with defined steps we are depending on a person to do ALL of the steps, in the correct order, without error.  That is just asking to have it done wrong.  The current method:  Select the DB to be reconciled and click OK is the correct way for us to do this. 

All the supporting tasks need to be built into the process under the covers.  I would have no problem if I am prompted on each set of Saved Specs/GlobalValues to reset to 0 or some other value, to keep values in DAT or values in DSR?  Or these decisions could be predefined in a an internal table as some type of property associated with each object.  Example:
Saved Specs1:  Prompt for each/Use DAT/Use DSR
Saved Specs2:  Prompt for each/Use DAT/Use DSR
GlobalValue1: Prompt for reset value (0=default)/Use DAT/Use DSR
GlobalValue2: Prompt for reset value(0 = default)/Use DAT/Use DSR
These values would be maintained in a database in the DB and used at the time of Reconcile.  Reoncile would prompt to accept values in internal database, or review all values and reset them also.

As a help to ourselves, we are all probably using our own naming conventions.  Maybe a different naming style for the Global Values would help.  I suspect that I will start to modify my naming to ID those GlobalValues that need to be maintained during Reconcile, and those that need to be reset.  At least that should make it easier when it comes time to follow the manual steps needed now.

Along that line, perhaps the GlobalValues themselves could become different types if that would make the reconcile process more accurate and error free,

I am glad we are having this discussion, but it is important to remember that we can accept some "inconvenience" and we can take the extra steps,  The real potential problem is the potential of bad data.  Until Sesame can do this by itself, I would still like to see a step by step process defined, in proper sequence, listing the things to be done to incorporate a DSR into correct sync with a newer DAT that will truly RECONCILE all of the GlobalValues, Saved Specs, etc. into a new DAT. 

Enuf ideas for now, gotta get back to work.......
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
proudpoppy
Full Member
Members
***
Offline


Do What ??

Posts: 420
Location: South Carolina
Joined: Apr 7th, 2004
Re: Globalvalue
Reply #12 - Aug 5th, 2004 at 4:18pm
Print Post Print Post  
Maybe my minds on vacation but it seems to me that when working in a dsr then reconcile it to the active db it should never change any values global or otherwise in the db, otherwise your asking for trouble. If it needs to be changed maybe a function or command like "@resetglobalvalue(nextrecordnumber, 1517) would work ??
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Globalvalue
Reply #13 - Aug 5th, 2004 at 4:27pm
Print Post Print Post  
Quote:
Maybe my minds on vacation but it seems to me that when working in a dsr then reconcile it to the active db it should never change any values global or otherwise in the db, otherwise your asking for trouble. If it needs to be changed maybe a function or command like "@resetglobalvalue(nextrecordnumber, 1517) would work ??


That may be correct for your particular situation, but it does not apply universally. It depends on what the global value is being used for.

There is a function GlobalValue(nextrecordnumber, "1517") which does exactly what you suggest with @resetglobalvalue.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Globalvalue
Reply #14 - Aug 5th, 2004 at 4:41pm
Print Post Print Post  
I would like to define a simple step by step process as you have asked, but that process is nearly infinitely variable depending on the circumstances of your particular application. Nor is it practical, nevermind less of a burden, to require a designer to decide these settings on a one-at-a-time basis. That is why I suggest, and now reiterate, that a programming approach to this distinctly programming problem, is the best solution. A programmer brought in to work on a non-original design is confronted with the same issue: what is the designer's intent? If their intent is to *not* retain, but rather to reset, how would a dialog indicate that intent? They (the new programmer) can't determine intent unless the original programmer indicates their intent. It is that intent that is the issue. If their intent is to reset some, and retain others, again, how do they convey that intent? By programming the intent into a mass update, or better, using a data based approach when these GV are used. The original programmer's intent is conveyed or is simply automatically implemented.

In practicum: If you design in a critical global value (like next invoice number) and you are in a .dsr centric design, you should have a GV that indicates a reset. On form open, if that value has been reset (a reconcile occurred) do an internal XLookup to reset the critical GV to the current maximum invoice number plus one, and sets the "reset GV" to its non-reset state.

Code
Select All
// Note the value: "2317" is merely a indicator that a reset did
// not occur
if(@GlobalValue("MyReset") != "2317")
{
   // Do the XLookup here
   GlobalValue("InvoiceCounter", result_of_xlookup)
   GlobalValue("MyReset", "2317")
}
 



As for specs, the same "intent issue" applies. Do you want to keep specs that were added by the user (not the designer) of the application. If that is your intent how do you convey that to Sesame? It may well be your intent to reset the system back to the "approved" specs.

As to the market, most of our users are single user, may or may not keep .dsr files around (I always use .db files and remake the .dsr, Erika always keeps the .dsr and makes the .db), most of our users are their own end users. From calls, I would guess that most of our users keep both the .dsr and the .db file on hand, and use one or the other depending on circumstance.

BTW: If you are single user, you can, if you wish, simply run a .dsr file from run time. The syntax:

C:\Sesame> sesame whatever.dsr

will run a .dsr file just like a .db file. The only proviso is that it must be specified on the command line.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send Topic Send Topic Print Print