Hot Topic (More than 10 Replies) Crashing Sdesigner (Read 2476 times)
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Crashing Sdesigner
Jan 6th, 2004 at 10:50pm
Print Post Print Post  
I can crash Sdesigner at will. I am not sure this is a bug as much as an ID 10 T  user error (ID10T) However I believe many beginning users will encounter the same results as they learn their way in Sesame.

I was working with global statics and variables and typed

var GSNextCustRecNo as int

GlobalValue(gsnextcustrecno, 221)

If @IsNew and PatientID = "" then {
PatientID = @tonumber(@GlobalValue("NextCustRecNo")) + 1
GlobalValue("NextCustRecNo", patientId)
}

 
I used the test button and received no errors. But when I save and preview,  Sdesigner crashes.

I seem to miss the boat when trying to understand Global features. I am obviously not comprehending something because I keep falling down at this spot.

I was following the Example of making a global record number and using this as a record id. I thought I would go to program Layout and under global code declare my variable.

var GSNextCustRecNo as int // my declaration saying that this variable will be a number

Then I thought I needed to Set the variable

(GlobalValue(gsnextcustrecno, 221)

Then I thought I needed to stick the logic in that executed the task. (I had no clue were to put it) (No comments from the peanut gallery please) I put it under global code thinking it would always be available and hoped once I pressed test and it found no errors I was not to far off  Embarrassed (Wrong Next Contestant Please)

If @IsNew and PatientID = "" then {
PatientID = @tonumber(@GlobalValue("NextCustRecNo")) + 1
GlobalValue("NextCustRecNo", patientId)
}

But this forces Sdesigner to close with a crash.

Were have I gone wrong?

Thanks
  

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: Crashing Sdesigner
Reply #1 - Jan 6th, 2004 at 11:20pm
Print Post Print Post  
[quote] var GSNextCustRecNo as int

GlobalValue(gsnextcustrecno, 221)

If @IsNew and PatientID = "" then {
PatientID = @tonumber(@GlobalValue("NextCustRecNo")) + 1
GlobalValue("NextCustRecNo", patientId)
}
[/quote]

Bob,

We're not getting your crash, but I'm also not sure that we're actually duplicating your condition.

I see a couple of things in your code:
1. Take it all out of Global Code and put it in an event, probably Form::OnFormEntry considering what you are trying to do.

2.  In your code above, you declare an integer variable. You then set a GlobalValue passing the value of the variable (in this case 0) as the name of the global value. You then retrieve a global value that has a different name, which does not exist and you have never set.

We tried all these things, but Sesame did not crash, so we're not sure what other factor is involved here. Could you send me your dsr so I can put it through debug?

Here's your code snippet redone:
[pre]
var GSNextCustRecNo as int

GSNextCustRecNo = 221
GlobalValue("NextCustRecNo", @Str(GSNextCustRecNo))

If @IsNew and PatientID = "" then {
       PatientID = @ToNumber(@GlobalValue("NextCustRecNo")) + 1
       GlobalValue("NextCustRecNo", @Str(PatientId))
}
[/pre]
  

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


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Crashing Sdesigner
Reply #2 - Jan 6th, 2004 at 11:47pm
Print Post Print Post  
Thanks for the guidance and help I will continue to play with the suggestions you sent.

I seem to keep thinking anything that has to do with Global variables needs to be on that Global Code screen.

I emailed the files to you.

Thanks again for all your help
  

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: Crashing Sdesigner
Reply #3 - Jan 6th, 2004 at 11:55pm
Print Post Print Post  
We got the files and we see the crash. Thanks for the bug report!

Meanwhile, if you ditch your Global Code and paste the code snippet I gave you above into Form::OnFormEntry you should be fine.
  

- 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: Crashing Sdesigner
Reply #4 - Jan 7th, 2004 at 2:37pm
Print Post Print Post  
We found the bug in Sesame. You were accessing a layout element in the Global Code section. I fixed the bug in Sesame that causes that to crash. But you shouldn't do that. Layout Elements will all have no value when running Global Code. In fact, you should not reference anything on the form whatsoever - there is *no* form when running Global Code - it runs before the form has opened.

BTW: Robert your form design and application design is really very impressive.
  

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: Crashing Sdesigner
Reply #5 - Jan 7th, 2004 at 5:03pm
Print Post Print Post  
Thanks. That code snippet worked great!  Cheesy

It was easy to modify so I now have separate auto numbering sequences for customer numbers, order numbers and invoice numbers.

This feature being able to have multiple @number is such an exciting thing to me. Cheesy:D

Thanks so much!
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Crashing Sdesigner
Reply #6 - Jan 7th, 2004 at 5:52pm
Print Post Print Post  
Quote:
This feature being able to have multiple @number is such an exciting thing to me.


Yes, I have read in manual that one can do that. Can you please elaborate on how one can accomplish that? Thanks.
  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Crashing Sdesigner
Reply #7 - Jan 7th, 2004 at 8:21pm
Print Post Print Post  
Quote:
Can you please elaborate on how one can accomplish that? Thanks.


In my case I started with a field I called PatientID the patient id is to be used as the customer number. There will be only one customer number per client.

This code Snippet that Erika was kind enough to post is the mechanism that creates the number and adds it to the record. I will attempt to explain its use the best I can. If I am to far off I am sure a Lantican will jump in and help correct me.

var GSNextCustRecNo as int // This is declaring the variable arbitrarily named GSNextCustRecNo as an integer (number)
 
GSNextCustRecNo = 221 // This is were I am setting my number to start. I arbitrarily picked 221

GlobalValue("NextCustRecNo", @Str(GSNextCustRecNo)) // This applies  results to the global variable holder. This is were // the number to be used resides at this moment.

 
If @IsNew and PatientID = "" then {
    PatientID = @ToNumber(@GlobalValue("NextCustRecNo")) + 1
    GlobalValue("NextCustRecNo", @Str(PatientId))
}

/*
This says that if I am adding a record that is new to the database and the patientid is empty that the patientid will be the globalvalue NextCustRecNo plus 1 and then it is updating the globalvalue so it will be available with the correct number when it is needed next.
*/

If you replace the field PatientID with the field you use as a record number and then put the above snippet in your form  with on form entry execution you should be set. Once you save and reconcile, every time you add a new record it will add the new record number to the form.

You can use the same logic and just change the variable and field names to work with as many forms or @numbers you need. Each one will be totally self contained.

I hope this is somewhat clear. If not let me know.   
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Crashing Sdesigner
Reply #8 - Jan 7th, 2004 at 8:59pm
Print Post Print Post  
Well Bob you have the logic right but it might be confusing.

Every time you want to use the global value NextCustRecNo you don't have to go back in and change your code to another number. Sesame will remember the last value of NextCustRecNo even if you close sesame, shut down the computer and bring it back up. So the only code you need to put in the field entry event is

If @IsNew and PatientID = "" then { 
    PatientID = @ToNumber(@GlobalValue("NextCustRecNo")) + 1 
    GlobalValue("NextCustRecNo", @Str(PatientId)) 


What I would do to iniatilize the global value for the first time, say you already have 510 records imported from QA, just type the following code in a mass update spec

    GlobalValue("NextCustRecNo", @Str(510)) 

Click Run, Click Interactive, Click Update, Click Cancel. Then the next time you add a record it will be Patient id #511, and it is important to remember that global values are stored as strings.
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Crashing Sdesigner
Reply #9 - Jan 7th, 2004 at 9:24pm
Print Post Print Post  
Quote:
Yes, I have read in manual that one can do that. Can you please elaborate on how one can accomplish that? Thanks.

The mechanism for this is called Global Statics. These are explained beginning on Page 53 of the Programming Guide.
  

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


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Crashing Sdesigner
Reply #10 - Jan 7th, 2004 at 9:40pm
Print Post Print Post  
Thank you very much Bob Scott and Ray. You guys are great.  Smiley   Thank again.
  
Back to top
 
IP Logged