RE: Fixed Length



I'm *assuming* that you don't want to change the actual data in your table to
match these formats, but rather pull the existing, normal, formats from the
record, and run a function to build that information into a string that you
can utilize with whatever barcode label you are working with.

I'm also assuming that this barcode label will be on a report so that it can
be printed? If so, you would ideally run the function from the report, as a
calculated field on the report.

If you could verify this, and give the datatypes for your fields, I should
be able to come up with a function to handle it.

*If* by chance you were going to update the actual table values to match
this desired format, I would strongly advise against it. All fields would
have to be Text fields in order for this to work accurately (no matter what
method you use), and for a number of other reasons, its generally a bad idea.
The barcode output string can be easily handled by two functions, and
reading values back from the string can be parsed easily as well, especially
due to the fixed lengths, and will require no adverse interference with the
core data in your tables.

So, let me know what the datatypes are and we'll go from there.

--
Jack Leach
www.tristatemachine.com

- "First, get your information. Then, you can distort it at your leisure."
- Mark Twain


"Ann" wrote:

Thank you for the help. I'm not sure what event this should go on though. I
tried a few of them and those that didn't give me errors didn't do anything
but update the table with the number I entered. There weren't and leading
zeros.

The only thing I did was to put the JobId after strOrig =

"dymondjack" wrote:

I believe there's a built-in function that can to this for you, but I'm not
sure what it is, so I'll offer an alternative way: run a loop until the
length of the string is equal to your fixed length, adding a 0 to the
beginning of it each time it loops. Note that all fields will need to be
string fields to do it, and each field would need a separate loop.

Dim strOrig As String
strOrig = 'Your original jobID, RunNumber, etc

While Len(strOrig) < 8
strOrig = "0" & strOrig
Wend



You would have to build them together from there...


--
Jack Leach
www.tristatemachine.com

- "First, get your information. Then, you can distort it at your leisure."
- Mark Twain


"Ann" wrote:

I have seven fields in my Table that need to be concatenated to create one
field used to create a 2D Barcode. Each of the seven fields has a fixed
length and the total lenght of all the fields has to be 100 characters.
These are the fields:

JobId (8 char)
Date (8 char)
RunNumber (2 char)
RecordNumber (8 char) - the key, starting with 1 and incrementing by 1 for
each record.
PageNumber (5 char)
PageCount (5 char)
Remaining (64 char)

I've done the Date field...that was the easy one...but how do I do the other
fields? The data will be entered and each field could use 1 character or all
the characters at the time it's entered. I need to have the remaining
character spaces fill in with zeros to the left of the data entered? Thanks
for the help in advance.
.



Relevant Pages

  • Re: Is this string input function safe?
    ... return a pointer to mallocated memory holding one input string, ... See my comment after your call to fgets. ... char* malloc_getstr ... before any characters are read, then the ...
    (comp.lang.c)
  • Re: RfD: XCHAR wordset (for UTF-8 and alike)
    ... extended to work with xchars, ... >replacing one char with another. ... before-cursor part, even for fixed-width characters. ... So, should string words ...
    (comp.lang.forth)
  • Re: Is this code totaly a shit?
    ... | void UppStrg(char *Low, char *Upp, int cnt); ... whitespace-delimited string. ... You're also assuming that the representations of the characters ...
    (comp.lang.c)
  • Re: Sorry, newbie question about generating a random string
    ... string grows to a max of 10 characters. ... The real problem is that you are not terminating the string. ... string is an array of characters ending in a null character, ... char myChar; ...
    (comp.lang.c.moderated)
  • Re: What is the logic of storing XML in a Database?
    ... formats, etc. ... So you have a string a characters and want to represent its structure? ... It is not a secret that XML sucks in this respect as well: ...
    (comp.databases.theory)