Page Index Toggle Pages: 1 [2]  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) Read Only AND Unique? (Read 6176 times)
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Read Only AND Unique?
Reply #15 - Aug 9th, 2007 at 3:25pm
Print Post Print Post  
OK, I removed all concatenation programming, and programmed in a test that HAS to be flagged, as so:
Code
Select All
on-change of Firstname element

var vFull as string

vFull = Firstname

// Checks to see if it's unique
If @IsUnique(Firstname, vFull) = 0
THEN
	{
	@MsgBox("This name is not unique.", "It already exists in the database.", "Please change the name or discard this record.")
	}
ELSE
// Sets the Full Name
	{
	FullName = vFull
	} 



I entered "Scott" in the Firstname field, and tabbed out.  I already exist in the database.  No error message, and Fullname happily filled with "Scott".

Then I did this:
Code
Select All
var vFull as string

// Capitalizes each word
cuInitialCaps()


vFull = "Scott"
// Checks to see if it's unique
If @IsUnique(Firstname, vFull) = 0
THEN
	{
	@MsgBox("This name is not unique.", "It already exists in the database.", "Please change the name or discard this record.")
	}
ELSE
// Sets the Full Name
	{
	FullName = vFull
	} 



Still no error, Fullname fills with Scott.

Then I did this, turned off the variable entirely:
Code
Select All
var vFull as string

// vFull = "Scott"
// Checks to see if it's unique
If @IsUnique(Firstname, "Scott") = 0
THEN
	{
	@MsgBox("This name is not unique.", "It already exists in the database.", "Please change the name or discard this record.")
	}
ELSE
// Sets the Full Name
	{
	FullName = vFull
	} 



Still no error message.
  

**
Captain Infinity
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: Read Only AND Unique?
Reply #16 - Aug 9th, 2007 at 3:53pm
Print Post Print Post  
Hello Scott,

Do you have more than one form in the application you are working in?

-Ray
  

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


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Read Only AND Unique?
Reply #17 - Aug 9th, 2007 at 3:57pm
Print Post Print Post  
No sir, I do not.
  

**
Captain Infinity
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Read Only AND Unique?
Reply #18 - Aug 9th, 2007 at 4:07pm
Print Post Print Post  
I'm officially giving up on this.  Thanks to everyone who pitched in to help, Erika, Ray.  I'm going to set it unique but writeable in properties and move on to some other project.  Thanks again.
  

**
Captain Infinity
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: Read Only AND Unique?
Reply #19 - Aug 9th, 2007 at 4:45pm
Print Post Print Post  
Keep it Unigue and writeable when @NEW, and make it ReadOnly once it has been committed and saved?
  



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


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Read Only AND Unique?
Reply #20 - Aug 9th, 2007 at 5:07pm
Print Post Print Post  
Yeah, OK, thanks Bob, that sounds good, I'll try that.

I did try one other thing after lunch: I made a completely new application with one database and one form.  Three elements: Firstname, Lastname, Fullname.  Programmed Lastname to concatenate on-change and test for uniqueness.  Went into preview, added 1 record.  Advanced, added the same data...and the test for uniqueness worked and I got the error message. 

When I use the exact same programming in my Personnel database, which also has just 1 form and the three same elements, it fails.  So clearly I've got some gremlins in Personnel.  I've Writelined the values of all the elements and the variable and they're exactly what I expect them to be.  Is there a way to Writeln the integer that is returned from @IsUnique?

But anyway, I've wasted most of the day on this and I'm very frustrated, and since it's really not vital in the long run because uniqueness can be set in properties, I think I'll move on.  Thanks again to everyone who tried to help, your support is much appreciated.

  

**
Captain Infinity
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: Read Only AND Unique?
Reply #21 - Aug 9th, 2007 at 5:15pm
Print Post Print Post  
Ypu asked: Any way to writeln the integer returned by the @Unique?

WriteLn the @Unique formula.  Example:
WriteLn ( "The value of @Unique is: " + @IsUnique(Firstname, vFull) )
  



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


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Read Only AND Unique?
Reply #22 - Aug 9th, 2007 at 6:02pm
Print Post Print Post  
Thanks Bob, I'll try that, see what it shows me.

Here's something else I'd like to try.  When FullName changes, I'd like to do a lookup into the database using its value as a key, into the same field.  Is that possible, or would it be whatchacall "recursive"?  If I create a variable I could use @Xlookup.  I'm thinking of something like this:
Code
Select All
on-change event of FullName

var vFullTest as string

NotifyForm(0) // Initialize save state

If @IsNew then
vFullTest = @XLookup(@FN, FullName, "Employee!FullName", "FullName")
	IF @error then
		{
		Writeln("Lookup Failed")
		}
	ELSE  // I'll cross this bridge when I come to it; so far every lookup has failed 

  

**
Captain Infinity
Back to top
IP Logged
 
Page Index Toggle Pages: 1 [2] 
Send Topic Send Topic Print Print