Page Index Toggle Pages: [1] 2  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) Subforms/Masking/Changing Field Type (Read 3746 times)
jyellis
Full Member
Members
***
Offline


No personal text

Posts: 114
Location: Dallas-Fort Worth Area
Joined: May 19th, 2003
Subforms/Masking/Changing Field Type
Jan 8th, 2004 at 5:35pm
Print Post Print Post  
I have 3 questions.  I have translated a Q&A 4.0 into Sesame.  (1360 records; with appx 100 fields/record)

1.  In "Manage Fields" I attempted to change my phone field and cell phone field from text to number.  I received a Microsoft Visual C++ Runtime Library error "Assertion Failed"

2.  We had 1 form in Q&A with the all the fields on 8 or 9 pages.  So I'm making it different forms for different tasks.  The first form is our "Application".  I have the main form but I wanted to put a 3 tabbed subform on here their medical info/vehicle info/talents.  However the user guide said you have to have two subforms?

3.  In creating the new forms, I want to create "masks" like "(    )      -           "  for phone numbers.

Thanks in advance.

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


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Subforms/Masking/Changing Field Type
Reply #1 - Jan 8th, 2004 at 6:04pm
Print Post Print Post  
Quote:
I have 3 questions.  I have translated a Q&A 4.0 into Sesame.  (1360 records; with appx 100 fields/record)

1.  In "Manage Fields" I attempted to change my phone field and cell phone field from text to number.  I received a Microsoft Visual C++ Runtime Library error "Assertion Failed"


I suspect I know what's going on here. I'll check it out. If it's not what I think it is, we may ask for your database. BTW, since phone numbers tend to have parentheses, hyphens, and things like "ext. 203" in them, you probabaly don't want to make them Number fields.

Quote:
2.  We had 1 form in Q&A with the all the fields on 8 or 9 pages.  So I'm making it different forms for different tasks.  The first form is our "Application".  I have the main form but I wanted to put a 3 tabbed subform on here their medical info/vehicle info/talents.  However the user guide said you have to have two subforms?

It's difficult to answer your question without a better idea of what you are trying to do. If you just want to take the existing elements on your 8 pages and reorganize them onto tabs on your form so they take up less room, then you don't need subforms.

Quote:
3.  In creating the new forms, I want to create "masks" like "(    )      -           "  for phone numbers.


Sesame does not support masks.
  

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


No personal text

Posts: 114
Location: Dallas-Fort Worth Area
Joined: May 19th, 2003
Re: Subforms/Masking/Changing Field Type
Reply #2 - Jan 8th, 2004 at 6:19pm
Print Post Print Post  
Yes I want to organize the form with existing elements with tabs?  How do I do that?
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Subforms/Masking/Changing Field Type
Reply #3 - Jan 8th, 2004 at 7:11pm
Print Post Print Post  
Quote:
Yes I want to organize the form with existing elements with tabs?  How do I do that?


Working with Tabs is nicely covered by one of the Tutorials, which  begins on page 34 of the Quick-Start Tutorials.
  

- 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: Subforms/Masking/Changing Field Type
Reply #4 - Jan 8th, 2004 at 7:39pm
Print Post Print Post  
Quote:
3.  In creating the new forms, I want to create "masks" like "(    )      -           "  for phone numbers.


Judy,

If you use this code snippet with on element Change execution it will format the phone number nicely. My field name was HomePhone so if you just replace that field name with yours it will work.

// Formats Telephone Number

var vHPhone as String
var vNewHPhone As String

vHPhone = @Num(HomePhone)
vNewHPhone = "(" + @Left(vHPhone, 3) + ") " + @Mid(vHPhone, 4, 3) + "-" + @Right(vHPhone, 4)
HomePhone = vNewHPhone 


I hope this helps. Smiley
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
jyellis
Full Member
Members
***
Offline


No personal text

Posts: 114
Location: Dallas-Fort Worth Area
Joined: May 19th, 2003
Re: Subforms/Masking/Changing Field Type
Reply #5 - Jan 8th, 2004 at 10:59pm
Print Post Print Post  
Thanks Bob!
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Subforms/Masking/Changing Field Type
Reply #6 - Jan 8th, 2004 at 11:22pm
Print Post Print Post  
If you want to get really slick, though probably a little annoying to your end users, you could use the "on immediate change" event and actively filter what they type.
  

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



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Subforms/Masking/Changing Field Type
Reply #7 - Jan 9th, 2004 at 2:18am
Print Post Print Post  
Quote:
var vHPhone as String
var vNewHPhone As String

vHPhone = @Num(HomePhone)
vNewHPhone = "(" + @Left(vHPhone, 3) + ") " + @Mid(vHPhone, 4, 3) + "-" + @Right(vHPhone, 4)
HomePhone = vNewHPhone  


Bob,

This code has a problem -- it doesn't check to see that there are the proper number of digits in the field before proceeding.  For example, try entering just "123" and exit the field.  You should see a result of "(123) 123" (it adds 3 more digits).  

Another more problematic situation would be if you accidentally entered only 9 digits when meaning to enter the full 10 that there should be.  If the intended phone number were (123) 456-7890, and you left off the last digit, you end up with (123) 456-6789, a very different number that may look OK because the programming is returning a full 10 digits.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Subforms/Masking/Changing Field Type
Reply #8 - Jan 9th, 2004 at 4:33am
Print Post Print Post  
Carl,

All good points. Well taken.  Smiley

The snippet was intended to be just a starting point for us beginners to get the basics down and use to school off each other. I am under the belief that a snippet is just that, a small snippet of code used to help someone move in the correct direction. The code was designed to handle a masking like task.

In my little fishbowl of a world the logic to just do the basic masking at this moment seems like an incredible step. I hope to improve my skills daily, but I am also sure that I will never run out of things to learn before I die.  Grin

I guess the next step will be to add data integrity logic to check all the points you brought up.

Thanks for the insights and helping in setting the goal for my next task.  Smiley
  

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


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Subforms/Masking/Changing Field Type
Reply #9 - Jan 9th, 2004 at 5:10pm
Print Post Print Post  
Attempt number 2. It checks to see if there are 10 numerical digits and pops up a message to the user if it is incorrectly entered (not enough or to many digits)

I know I could also put the user back into the HomePhone Element and make the popup prettier. This code could probably be made much more compact but I was stepping through the process 1 step at a time.


// Formats Telephone Number

var vHPhone as String    
var vNewHPhone As String 
var vhphonecount
var vhpnentered

     Vhpnentered = @num(HomePhone)
     // Writeln(Vhpnentered)
     
     vhphonecount = @num(@len(vhpnentered))
     //writeln(vhphonecount)

If vhphonecount = "10"


{
     vHPhone = @Num(HomePhone)
     vNewHPhone = "(" + @Left(vHPhone, 3) + ") " + @Mid(vHPhone, 4, 3) + "-" + @Right(vHPhone, 4)
     HomePhone = vNewHPhone 
}
else
{
     Writeln("The Telephone Number needs to be Exactly 10 Digits")
       Writeln("The numbers you entered: " + @num(Homephone))
       Writeln("is : " + Vhphonecount + " Digits Please check Home Telephone and Re-enter")
     
}
  

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


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Subforms/Masking/Changing Field Type
Reply #10 - Jan 9th, 2004 at 9:37pm
Print Post Print Post  
I found that @msgbox works real nice instead of writeln.
I have 2 oddities when this code executes that I do not understand.

First. After the @msgbox is presented you have to hit enter or mouse click ok two or three times before it goes away and returns me to the Homephone element.

Second using the @color(HomePhone,7,4) I thought I would have HomePhone element Red background with  white text but the background does not turn red. Is this a monitor issue, an issue because the Home Phone is on a Tab or something I am doing incorrectly?

Thanks


// Formats Telephone Number

var vHPhone as String    
var vNewHPhone As String 
var vhphonecount
var vhpnentered

     Vhpnentered = @num(HomePhone)
           
     vhphonecount = @num(@len(vhpnentered))
     
If vhphonecount = "10"

{
     @color(HomePhone,0,7)
     vHPhone = @Num(HomePhone)
     vNewHPhone = "(" + @Left(vHPhone, 3) + ") " + @Mid(vHPhone, 4, 3) + "-" + @Right(vHPhone, 4)
     HomePhone = vNewHPhone 
}
else
{
     @color(HomePhone,7,4)
     @msgbox("The Telephone Number needs to be Exactly 10 Digits", "The numbers you entered " +
     @num(Homephone),"is : " + Vhphonecount + " Digits Please check Home Telephone and Re-enter")
     Goto HomePhone 
}   

   

  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Subforms/Masking/Changing Field Type
Reply #11 - Jan 10th, 2004 at 6:32pm
Print Post Print Post  
Bob,

I just dropped the program above into the on exit event for a text field, and it seems to be working very well. The colors changed and the msgbox only appeared once and correctly.

Could some other event program be interfering?
  

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: Subforms/Masking/Changing Field Type
Reply #12 - Jan 11th, 2004 at 2:51am
Print Post Print Post  
Quote:
Bob,
Could some other event program be interfering?


Sure could.

I am going to copy my dsr then remove everything but that one bit of code and see how it behaves. If all is fine I will then put each piece of code  back one at a time and see when my problem comes back.

I will keep you posted.

Thanks
  

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



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Subforms/Masking/Changing Field Type
Reply #13 - Jan 11th, 2004 at 3:56am
Print Post Print Post  
Quote:
Second using the @color(HomePhone,7,4) I thought I would have HomePhone element Red background with  white text but the background does not turn red.


Bob,

I also tried your code like Mark did, and @msg works correctly for me too.  But the colors don't come out the way the Programming Guide indicates (pg 80).  I get a color change, but the background changes to gray, not red.  If you change it to read @color(HomePhone,7,1) you should get White text and Red background.


Mark,

Were you aware of the color listings being wrong?
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Subforms/Masking/Changing Field Type
Reply #14 - Jan 11th, 2004 at 3:25pm
Print Post Print Post  
Quote:
Mark,

Were you aware of the color listings being wrong?


No, I wasn't. Please could one of you file a bug report on the subject.

http://www.lantica.com/Support/support_request_form.html
  

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