Normal Topic Blank record being added in update mode (Read 834 times)
Louis Galvao
Full Member
***
Offline


"Sufferin' Succatash"

Posts: 265
Location: Canada
Joined: Feb 14th, 2005
Blank record being added in update mode
Feb 24th, 2006 at 10:33pm
Print Post Print Post  
I have had a small issue for the last little while whereby one of my report command buttons was adding a blank record in the search/update mode.

I narrowed it down and was able to duplicate it with one specific button.

On Form Entry I do have the following code whereby if the user scrolls thru all the records, they cannot add when in update mode:

//Prevents User from adding records in Search/Update mode but allows saving

If @Update Then
{
     If @ResultSetCurrentPosition() = @ResultSetTotal() Then
           {
                 NotifyForm(2)
           }
           Else
           {
                 NotifyForm(-2)
           }
}


This exact code is also in my command button that is giving me the problem.  It is also in other command buttons that do not create any issues.

The code starts off with above, pops up a menu, determines a month, loads the relevant retrieve spec and runs the report as follows (is there anything readily apparent without having to interpret the code below that you can see ?):

NOTE: it only happens on form entry and clicking the command button prior to searching for any records.  If you bring up a record first, it will not add the blank record. 

I just realized as I was writing this, this button has the @SAVE call before loading the retrieve spec.  None of the other command buttons has this call.  There was a reason why we put it in and I think it had something to do with records being modified accidentally.  I will test it without it and see what happens.


//Command Button programming

var vMonth as String      
var vRun as Int
var vSpec as Int
var vRetrieve as String
var vTree as Int

//Prevents User from adding records in Search/Update mode but allows saving

If @Update Then
{
     If @ResultSetCurrentPosition() = @ResultSetTotal() Then
           {
                 NotifyForm(2)
           }
           Else
           {
                 NotifyForm(-2)
           }
}


//offer user choice of reports to print

//popup is placed directly over Print Button

PopupSelectPosition(4, @XPos(PAYROLL ADVANCES MTH), @YPos(PAYROLL ADVANCES MTH))

vMonth = @Popupmenu("01-JAN;02-FEB;03-MAR;04-APR;05-MAY;06-JUN;07-JUL;08-AUG;09-SEP;10-OC
T;11-NOV;12-DEC", "Select A Month")

If @LEN(vMonth) = 0
{
     vMonth = "JAN"
}
Else
{
     vMonth = @Right(vMonth, 3)
}
GlobalValue("Report Month", vMonth)

//LOADS RETRIEVE SPEC

vRetrieve = "01-JAN;02-FEB;03-MAR;04-APR;05-MAY;06-JUN;07-JUL;08-AUG;09-SEP;10-OCT;11-NOV;12
-DEC"


If @LEN(vRetrieve) = 0
{
     vRetrieve = "JAN"
}
Else
{
     vRetrieve = @Right(vRetrieve, 3)
}

@SAVE

vSpec = @LoadRetrieveSpec("PAYROLL ADVANCES - " + vMonth)
vRetrieve = @LoadSortSpec("PAYROLL ADVANCES")
vTree = @SelectTreeItem("Search Menu!Search Commands!Retrieve New Results (F10)")


vRun = @SelectTreeItem("Search Update Menu!Results Commands!Reports!Employee!Payroll Advances - Mth (Preview)")


  

Louis Galvao
Back to top
 
IP Logged
 
Frederick_JH
Junior Member
**
Offline


Open Sesame . . . the
magic portal awaits!

Posts: 52
Joined: Jan 26th, 2004
Blank record being added in update mode
Reply #1 - Feb 28th, 2006 at 4:25pm
Print Post Print Post  
I looked over the code you are talking about that keeps the user from adding blank records in On Form Entry mode by preventing Sesame from entering extended mode in Search/Update.  This is right from the manual (version 1.1) on page 193.

I have a question that about the programming statement

Code
Select All
NotifyForm(-2) 




Why is this  -2 ? The manual does not show this as a option. The options are:

NotifyForm() sets a flag on the current record to prevent or allow saving.
0 - Clear all flags, allow saving
1 - Prohibit saving
2 - Allow save, prohibit record advance
3 - Allow save, prohibit record retreat
4 - Prohibit delete record
5 - Prohibit remove record from results
6 - Disallows the tab the form is on to be closed.

Is the -2 an attempt to clear the flag?  Would it not be better to set a 0 flag like this?

Code
Select All
If @Update Then
{
If @ResultSetCurrentPosition() = @ResultSetTotal() Then
{
NotifyForm(2)
}
Else
{
NotifyForm(0)
}
} 



I have tried this on my forms and it works the same as the programming in the manual as far as I can tell.
  

Frederick Henderson*Radio HRGS*Roatan*Bay Islands*Honduras
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: Blank record being added in update mode
Reply #2 - Feb 28th, 2006 at 4:45pm
Print Post Print Post  
Hello Fredrick,

A -2 clears only the 2 flag but a 0 clears all flags. Page 193 of the 1.1 Manual in the first paragraph after the code explains this.

-Ray
  

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



Posts: 2530
Joined: Nov 22nd, 2002
Re: Blank record being added in update mode
Reply #3 - Feb 28th, 2006 at 4:46pm
Print Post Print Post  
Frederick,
From page 193 of the programming guide:
Quote:
Setting the flag to the negative of the value turns off that flag without affecting the other flags.


PS: Frederick, please remove the ad from your sig. It violates Forum policy and user agreement.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
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: Blank record being added in update mode
Reply #4 - Feb 28th, 2006 at 4:48pm
Print Post Print Post  
Hello Louis,

Is this in the application that you sent me last week?

If it is could you give me steps so I can reproduce it here.

-Ray
  

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


Open Sesame . . . the
magic portal awaits!

Posts: 52
Joined: Jan 26th, 2004
Re: Blank record being added in update mode
Reply #5 - Feb 28th, 2006 at 4:54pm
Print Post Print Post  
Oh , Sorry!  Cry

Where do I find the  Forum policy and user agreement at?
  

Frederick Henderson*Radio HRGS*Roatan*Bay Islands*Honduras
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Blank record being added in update mode
Reply #6 - Feb 28th, 2006 at 5:12pm
Print Post Print Post  
It is presented when you first join the forum and you click a button stating that you agree to its terms to join.

We aren't really very strict about it. If someone wants to have a link to the company they own or are directly working for, no one minds. But a third party ad is too much of an invitation for the folks that post nothing but ads to say: "but you let him do it".

I sent you a private message asking if the ad is for a company you own or work for. If it is, you can continue to use it as your sig. Also, if you want you can recommend the company in the off topic board, if you think they are particularly good.

We regularly have to depost and revoke the memberships of spammers and others that do nothing but post ads to the forum. They are a constant problem. I don't class your ad in the same category, but I don't want them to have any grounds to claim that we let some people break the rules while others cannot.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Louis Galvao
Full Member
***
Offline


"Sufferin' Succatash"

Posts: 265
Location: Canada
Joined: Feb 14th, 2005
Re: Blank record being added in update mode
Reply #7 - Feb 28th, 2006 at 5:24pm
Print Post Print Post  
Ray:

This is the App that I sent you previously.

Open the form in Search/Update, F10 to see the total number of records in the database. (I am not sure if the App you have already has a blank record, if so search for empty in FirstName and delete record).

Exit out of the form and go back in.

Go right to the Reports tab without loading any records and click on Payroll Advances - MTH and select any month from the popup.

After the report displays, clear the retrieve spec that was loaded, F10 to select all records and you should notice an extra record.  Search for a blank record where FirstName is empty.

In the meantime, I removed the @SAVE call in this button and testing indicates that everything seems to be fine without it.  It may have been a problem I encountered early on in the development of this App in early 2005 and may have been fixed by updates.

Thanks,

Louis
  

Louis Galvao
Back to top
 
IP Logged