Alpha Video Training
Page 1 of 2 12 LastLast
Results 1 to 30 of 34

Thread: Masked fields for display only

  1. #1
    Member
    Real Name
    Chris Boullear
    Join Date
    Dec 2002
    Posts
    52

    Default Masked fields for display only

    Help!

    I've been around and around with the documentation and field rules screen trying to figure out how to insert dashes into the DISPLAY of a field, not into the actual field. Example:

    Field is 11 character field:

    12345123412

    I want to DISPLAY it on the screen as:

    12345-1234-12

    I do NOT want to make it a 13 char field as I much match to another DBF carrying it as 11 char field.

    Every time I've tried this, the dashes have been kept in the field and the last two digits of the part # have been truncated! (I've been checking "Do not store literals as part of field box" and then unchecking it. Can't find a comination that works.)

    Any help is appreciated....

    Chris

  2. #2
    Vince McGinnis
    Guest

    Default RE: Masked fields for display only

    Chris,

    You could define a Global Calculated Field, which you could use in both your forms and reports.

    It would be something like Left(Yourfield,5)+"-"+Substr(Yourfield,6,4)+"-"+Right(Yourfield,2)

  3. #3
    Member
    Real Name
    Chris Boullear
    Join Date
    Dec 2002
    Posts
    52

    Default RE: Masked fields for display only

    Thanks, but is there anything simpler? In Access I could just use a mask like:

    00000-0000-00

    and it would work.

    Chris

  4. #4
    Vince McGinnis
    Guest

    Default RE: Masked fields for display only

    I quess I did miss the obvious.

    You should be able to do what you want using field rules.

    Did you read User Guide, page 112, under Masks, "Specifying That Mask Literal Characters Are Not Stored".

    You should be able to specify a mask without actually storing the extra characters.

  5. #5
    Vince McGinnis
    Guest

    Default RE: Masked fields for display only

    Chris,

    Just tested this mask in field rules and it works fine.

    Though you don't have to change the structure of your table to accomodate the extra characters, if you display your field on a form or report, you will need to adjust the size of the form/report field properties so you can see the entire field.

    Hope that makes sense.

  6. #6
    Member
    Real Name
    Chris Boullear
    Join Date
    Dec 2002
    Posts
    52

    Default RE: Masked fields for display only

    Thanks for your help, but I must be brain dead or something. I have tried setting up field rules several times, and and all resulted in the last two characters of my field being truncated. I am using:

    Simple Mask: 00000-0000-00 "do not store mask literals in field" IS checked.

    What am I doing wrong????

    Chris

  7. #7
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Masked fields for display only

    Chris, that's not a fair question.

    Try telling us exactly what you are doing, and we can tell you what looks wrong to us. I'll try to whip up a simple example for you this evening. Perhaps by comparing yours to mine, you will be able to see the differences.

    -- tom

  8. #8
    Member
    Real Name
    Chris Boullear
    Join Date
    Dec 2002
    Posts
    52

    Default RE: Masked fields for display only

    I have a little test database with 5 fields, each 11 char long and filled with the string "12345123412".

    I went to field rules and defined as stated above:

    Simple Mask
    Mask reads: 00000-0000-00
    I DID check the box "do not store mask literals in field"

    When I save the field rule and look back at the data (and yes, I did widen the field on the screen to make sure I was seeing the whole thing), this is what I see:

    12345-1234-

    It looks to me like it DID store the literals and truncated the right two characters.

    Is there another way to look at the data? I just widened the field to provide plenty of space and the last two char are not visible.

    I tried opening just the little test DBF file with A5 and it said "unexpected file format"????
    Chris

  9. #9
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Masked fields for display only

    Chris, the field object used to display your field in the form must be increased. It defaults to the width in your table (11). When the mask inserts two new characters (the hyphens) the new string (which is now 13 chars long) won't fit. Open form in design mode, and adjust the display width property of the field object. You'll find it on the format tab page I believe.

    I verified that the field rule is working as expected just now. Here's a summary of my own findings. Perhaps you'll find it useful.

    Code:
    Used this mask for Character type field:
    
    00000-0000-00
    Checked box so that mask literals would NOT be stored in field
    
    Got these results when entering field value:
    12345123412
    
    Structure	Value stored   			Value displayed
    Field Width	in field			on form or browse
    11		"12345123412"			12345-1234-12 (Note1)
    
    
    13		"12345123412  "	(Note2)		12345-1234-12
    
    
    Once this field rule is defined, it's difficult to verify what
    value is stored in the field, because the mask is used to
    insert hyphens each time the field is displayed on a form
    or in a browse.  Actual values stored in the field were 
    determined using third party tools (Excel and WordPerfect).
    
    Note1:  To display the complete value, the display field or column
    must be increased to 13, even though the field width in the table
    is only 11.
    
    Note2:  Left justified, with two blank spaces trailing the 11
    character string of numbers.
    --tom

  10. #10
    "Certified" Alphaholic
    Real Name
    Ohlen Cartmell
    Join Date
    Apr 2000
    Posts
    1,599

    Default RE: Masked fields for display only

    Tom,
    I am unable to duplicate your results here. In fact, I get the same thing as Chris. If I create an 11 character field and define a mask as 0000-00-00000 and then set the field width on the form to 13, I can get only 1234-56-789 on the form.

  11. #11
    Member
    Real Name
    Chris Boullear
    Join Date
    Dec 2002
    Posts
    52

    Default RE: Masked fields for display only

    Maybe what I'm not "getting" is what you termed "Structure Field Width".

    In browse mode I just opened the field to a wider column by dragging the column wider.

    In Form mode I widened the field contents box to way wider than would be necessary to see all characters.

    In both instances, date looked truncated.

    Is there some other place that I need to set the "Structure Field Width" to 13?

    I did open up the DBF file in Excel and still see the full 11 characters as you did. The problem must be in how the display is set, yet dragging the field to a wider width is my normal way in Access of seeing the wider contents. Is there another way to do this in A5?

    Chris

  12. #12
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Masked fields for display only

    Chris and Ohlen,

    The display in the browse layout shows only the first 11 chars of the string. I cannot get it to show the full 13 (11 in table structure, plus 2 more added in field rules.)

    However, if you guys will play with the default form for the table (instead of the browse) you can get the desired result if you do two things:

    a) stretch the field object wide enough to show all 13 chars; and

    b) as I indicated before, visit the field object in design mode and set its display width to 13.

    Both are required. This is how it works in Vers 4 also. Simply grabbing an edge of the field object on the form and dragging it wider is not enough. The display width (format) of the field object must be adjusted, too.

    -- tom cone

  13. #13
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Masked fields for display only

    Chris, I don't recall a lot of message traffic on this mask issue. My assumption has always been that just about everyone wants the mask characters stored in the field, they just don't want the operator to have to key them in. If my assumption is right, then your desire to strip the mask characters out for storage purposes, and then put them back in for display purposes, is in the distinct minority. I've always felt that your approach was more trouble than it's worth. Even if I have share the data with other programs it's easier to write a script which removes the hyphens than to never know whether or not what you see on the screen is actually what's in the table.

    -- tom

  14. #14
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Masked fields for display only

    Chris & Ohlen,

    I owe you both an apology.

    Turns out my form works well only because I entered the 11 digit number while the mask was turned off. when I turned it back on the form behaves correctly, as I described. Otherwise, the form won't let you enter more than 11 digits, including the mask chars, if the table field width is only 11... even if the display width of the field object on the form is set to 13.

    Hadn't run into this before the reasons outlined above. Most store the literals in the field.

    simple solution here is to change table structure to increase the stored field width to 13. Costs you two blank spaces at the end of each 11 digit field, but these can always be trimmed off.

    My own strong preference would be to store the mask literals with the data.

    If time permits I'll see if this is behaving differently in vers 5 than in vers 4.

    -- tom

  15. #15
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Masked fields for display only

    Chris, Ohlen,

    this same behavior seems to have been present in vers 4, also. Check this link in the vers 4 forum:

    http://msgboard.alphasoftware.com/alphaphorum/read.php3?sortby=lastreply&direction=desc&num=4&id=4053&thread=4053

    -- tom

  16. #16
    Member
    Real Name
    Chris Boullear
    Join Date
    Dec 2002
    Posts
    52

    Default RE: Masked fields for display only

    Ok, I'm convinced.

    I think what threw me was that the default browse and form never changed. I had to create and save another Named form in order to see the data correctly.

    This is a big departure from Access. I'm used to dragging fields wider in order to see wider data structures.

    I'm trying to convert to A5 because Francie Peake wrote an application for my industry in A5 and I want to merge additional data with what she's already written in a format that makes sense to my employees who will be using her program. I'm not thinking like an A5 person yet. I still think like an Access person.

    There are a lot of things in A5 I really like, but I think there are also a lot of things I'm going to miss from Access.

    Thanks to all for your help.

    Chris

  17. #17
    Member
    Real Name
    Chris Boullear
    Join Date
    Dec 2002
    Posts
    52

    Default RE: Masked fields for display only

    OK, maybe I'm not convinced.

    My industry deals with UPC numbers and NDC Numbers ( the RX equivalent of a UPC). I have crews of 30 people out taking inventory by scanning UPC's and NDC's. The bar code scans do NOT include any imbedded dashes. A UPC and an NDC are always 11 characters long.

    When running the data captured by the crew up against commercially supplied and customer supplied databases of 11 character UPC and NDC fields, it is highly impractical for me to INSERT dashes into those databases. The handheld machine captures an 11 digit string at the auditor level and I must run it up against databases of 11 digit strings in order to pull in prices and descriptions. The dashes in the display are just to make it easier to read on the screen. The example provided is an NDC divided into it's mfr #, drug #, and pkg size # (5-4-2 format).

    If I started storing those numbers WITH the imbedded dashes I would have to rework every bit of data coming out of my handhelds to INSERT dashes in a standard NDC or UPC. (in other words, this would negate the value of scanning a bar code that comes out as an 11 digit string - industry standard in all UPC environments.)

    It is imperative that I be able to store various string lengths at the field level, but display with dashes in order to make it easier for PC operators to work with the numbers while looking for errors and making corrections.

    Thanks,
    Chris

  18. #18
    "Certified" Alphaholic
    Real Name
    William Hanigsberg
    Join Date
    Apr 2000
    Location
    Toronto, ON
    Posts
    4,018

    Default RE: Masked fields for display only

    "It is imperative that I be able to store various string lengths at the field level, but display with dashes in order to make it easier for PC operators to work with the numbers while looking for errors and making corrections."

    If I understand properly it should be simple to do this. Set the field with to 11 chars in both table definition and form definition and scan away.

    Am I correct or have I missed something.

    Bill

  19. #19
    "Certified" Alphaholic
    Real Name
    William Hanigsberg
    Join Date
    Apr 2000
    Location
    Toronto, ON
    Posts
    4,018

    Default RE: Masked fields for display only

    Sorry,

    I should have written 13 characters in both places.

    Bill

  20. #20
    "Certified" Alphaholic
    Real Name
    William Hanigsberg
    Join Date
    Apr 2000
    Location
    Toronto, ON
    Posts
    4,018

    Default RE: Masked fields for display only

    Sorry again,

    I just reread your first message and was reminded that you had a reason for avoiding a 13 char field.

    I'll check into this further. I can't help thinking there is a simple solution for this.

    Bill

  21. #21
    Member
    Real Name
    Chris Boullear
    Join Date
    Dec 2002
    Posts
    52

    Default RE: Masked fields for display only

    Thanks for any help you can provide. It's been a long day and my daughter is sick. I'm signing off for the night. I'll check back in the A.M.

    Chris

  22. #22
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Masked fields for display only

    Chris, I certainly did not mean to offend.

    Your application sounds like one where it would be inadvisable to store the mask literals in the table field. No argument here. The only point I was trying to make is that for folks who are doing data entry by hand (and that's the vast majority of Alpha Five users) they usually store the mask literals in the field. Hence, there haven't been a lot of folks that have stumbled into the bog in which you are currently mired. I did not say, nor did I mean to imply, that it's always advisable to store mask literals. Obviously, that's not true.

    -- tom

  23. #23
    "Certified" Alphaholic
    Real Name
    William Hanigsberg
    Join Date
    Apr 2000
    Location
    Toronto, ON
    Posts
    4,018

    Default RE: Masked fields for display only

    Well hello again everybody.

    I thing nobody owes anybody an apology because this is confusing.

    I set up a test table, with a single field, character, width=11. I defined a mask with a dash (-) after the fifth character in the field which I also set to require numeric characters. So the mask was "00000-000000"

    The idea is we want to
    -display but not store mask characters per field rules.
    -not increase the field length to include the unstored mask characters.

    I then created a saved browse and a saved form. In each case I went to the format tab and increased the size to 12 so as to be able to display the 11 stored characters plus the mask (-).

    Here is where it becomes confusing:
    -it works for a saved browse;
    -however it does *not* work for a saved form.
    -it doesn't work with an embedded browse,
    -nor does it work with an embedded saved browse layout.

    So the answer appears to be that if Chris can make do with a browse rather than a form he can have his wish. If he needs forms he cannot.

    I created a simple report and was able to print the 11 stored characters plus the mask.

    So what are we to make of this inconsistancy (or have I just confused myself, yet again)?

    All the best,
    Bill

  24. #24
    "Certified" Alphaholic
    Real Name
    William Hanigsberg
    Join Date
    Apr 2000
    Location
    Toronto, ON
    Posts
    4,018

    Default RE: Masked fields for display only

    It should be obvious from the above that I checked the box to *not* store mask literals.

    Bill

  25. #25
    "Certified" Alphaholic
    Real Name
    jim chapman
    Join Date
    Apr 2000
    Posts
    1,779

    Default RE: Masked fields for display only

    Hello All,

    I just read this thread, and maybe I'm missing something, but at least as a quick easy fix (if all we are dealing with is a display issue in a form or browse) why not add a field to the table, define it in the field rules as a calculated field. Then make its expression the value of the 'real' field with the dashes. The calc field will evaluate in real time. If data entry needs done into this 'displayed' field, then you'd have to do a little more work.

    Jim

  26. #26
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Masked fields for display only

    Jim, that's better than adding enough extra spaces to the field width in order to accommodate the mask literals at 'display' time. I like it.

    -- tom

  27. #27
    Member
    Real Name
    Chris Boullear
    Join Date
    Dec 2002
    Posts
    52

    Default RE: Masked fields for display only

    Tom,

    I'm sorry if I came off a little grouchy in that email. Please accept MY apologies. Long day, sick kid, yada, yada, yada....

    I'm not exactly sure I understand the latter part of this thread, with the calc field and all, but I'm willing to give it a try. I guess I just thought this would be a minor issue because Access handles it so easily. I figured I had just missed a step somewhere. Let me try a few things over the next day or so and then I'll get back to everyone.

    Thanks to all.....have a Happy New Year....and by the way, I'm a "she", not a "he"...

    Chris

  28. #28
    "Certified" Alphaholic
    Real Name
    William Hanigsberg
    Join Date
    Apr 2000
    Location
    Toronto, ON
    Posts
    4,018

    Default RE: Masked fields for display only

    Hi Jim,

    I hear what you are saying. I just think there is something a bit odd about having to size a field to accomodate the mask literals which you are *not* storing.

    Bill

  29. #29
    Russell Rowton
    Guest

    Default RE: Masked fields for display only

    Chris,
    I've read this entire thread (a long one); I've had the same problem, and I for one do not like to store the literals in the field.

    I solved my problem by defining the field width on the form to include the extra spaces, plus, I had to define the FIELD longer in the table structure to accomodate the literals.

    I never did understand why I had to add the extra spaces to the table structure, but it wouldn't work unless I did it that way.

  30. #30
    Member
    Real Name
    Chris Boullear
    Join Date
    Dec 2002
    Posts
    52

    Default RE: Masked fields for display only

    Wow, if it is that easy, I can live with that solution.

    Thanks! That will be the first thing I try....

    Chris

Similar Threads

  1. Display problem with 2 calculated fields in report
    By Sandy Nichols in forum Alpha Five Version 6
    Replies: 4
    Last Post: 06-01-2005, 09:40 PM
  2. Limiting field input to numeric and masked.
    By Probably Not in forum Web Application Server v6
    Replies: 4
    Last Post: 02-02-2005, 06:05 PM
  3. Tabbed object does not display fields In A5V4
    By Manish Bhalla in forum Alpha Five Version 4
    Replies: 2
    Last Post: 01-18-2001, 03:26 PM
  4. Browse fields don't display
    By russ Boehle in forum Alpha Five Version 4
    Replies: 3
    Last Post: 01-07-2001, 06:45 PM
  5. Button Genie & Masked Fields
    By Tom Cone Jr in forum Alpha Five Version 4
    Replies: 3
    Last Post: 09-09-2000, 04:02 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •