Jump to content
Server Maintenance This Week. ×

Parsing text from badge reader


This topic is 7229 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

I am a filemaker newbie. I have done programming in Business Basic and Visual Basic but the filemaker scripting interface is very different. My reason for using filemaker for this purpose is I want to put a new application on my Powerbook to use at a trade show:

I have a credit card kb wedge reader. The reader outputs plain ASCII text. I have a badge from a previous trade show which uses / as the field separator. I want to scan the trade show badge into a temporary field, parse the data into name, address, etc so I can add a record which will contain all the badge information. (I may have to revise the parsing if the badge from the upcoming trade show organizes the data differently)

What would be the best source of scripting information. If necessary I can upgrade my filemaker 5 to filemaker 7

Any info would be greatly appreciated.

Thanks,

paulr211 confused.gif

Link to comment
Share on other sites

If you have programming experience this should not be problem for you. Basically you would use a script with a Loop (or just auto-enter by calculations, if a script is awkward with your reader), which parses the text and sets the appropriate fields. The Left ( for the 1st value), Position, and Middle () functions are the tools. The last parameter of the Position function is "occurrence." You can increment a Counter global field to bump the occurrence of "/" for each pass, 1, 2, 3, etc., up to the number of fields (data).

What you want is the text between 2 occurrences of "/". The "start" of the Middle function would be the Position of "/" at the occurrence. The "size" of the Middle function would be the Position of the next occurrence minus the Position of the occurrence.

Middle(TextField, Position(TextField, "/", 1, _gCounter) + 1,

Position(TextField & "/", "/", 1, _gCounter + 1)- Position(TextField, "/", 1, _gCounter) - 1)

_gCounter is "zero indexed" in this case, so 0 gets the 1st value, 1 the 2nd, .... I usually use Left() for the 1st value.

Questions: Are these fields (in between the "/") always the same order? Is there a "/" placeholder if data is missing? If "No" to both, are they labeled?

Version 7 would be about the same. Though it has "MiddleValues" function that would make this simpler, after converting all "/" to "

Link to comment
Share on other sites

  • Newbies

This is what the data looks like from the badge I have. It's one long string. I substituted field descriptions below for the actual data. All fields are present with a space (null?) if no data. On my badge there was a blank field after zip code so I guess that's for country, same for fax number.

%REGISTRATION NUMBERFIRSTNAME^LASTNAMEPOSITIONCOMPANYADDRESSADDRESS2CITY^STATE^ZIPCOUNTRYPHONEFAXEMAILMISC CODES P 3,B 6,I 1]?# ?

The is the field separator, the ^ for sub-fields. A good read finishes with ?# ? and newline, a bad read with ?;E?# ? and newline.

I am not certain of the badge format of my trade show. Initially I will just parse into field1, field2, etc. I can put the correct field descriptions in later. The format may be different for the next show and the next show may use a 2D bar code badge instead of the credit card type badge.

The new books on filemaker 7 won't be published until August; I did find a recent book in the NYC public library which should help with my first foray into filemake scripting.

Thanks for your help.

paulr211

Link to comment
Share on other sites

This should not be difficult. It seems to me that the use of "^" is superfluous, since, as you say, all fields are present, even if empty. That is, if data is missing, you just get an extra or ^.

If that's the case, I'd use Substitute to replace "^" with "", then parse it out with the Middle function in a Loop. Or just change the Middle function slightly for those that have "^".

I made a little example file. It has a plain (but tedious, only partially completed for that reason) field parsing script. And also a fancy-dancy Loop, Set Field parsing script, which requires the fields on the layout in the same order, but otherwise is more fun :-).

ParseBadge.zip

Link to comment
Share on other sites

Attached is another way to parse this using calculated fields. The

calculation uses the global delimiter field as the pointer for the

Middle function and position function. The calculations are identical

except for the occurence field in the position function. Using the

global delimiter allows a quick change to different delimiters without

re-writing the calcs. I've put in two examples of formating the name

field also. If you are not concerned about parsing out these fields you

can simply substitute the delimiter with other text. If you want to

parse these into their own fields the second example sets up the field

as a value list which can then be manipulated using the value functions

to extract them either within the calc field or via a script. I would

not recommend substituting the sub category delimiters, as these are

used in the event there may be different quantities of this delimiter

for any given record, for example the name function may have a middle

name or initial, thus this field would then have 3 sub fields.

Link to comment
Share on other sites

  • Newbies

I finished the entry screen and it works! I had trouble getting the loop version to work. I obviously overlooked something.

The version using field names worked perfectly. yay.gif I made a script which pauses after parsing the fields so that I can enter notes; continue adds a blank record for the next scan. I put my logo and the trade show logo in the header to give a more finished appearance.

You gentlemen are great. Thanks for your help.

paulr

Link to comment
Share on other sites

  • 3 weeks later...

Given that you have access to the NYC library (I assume the Main Branch), look for 'Scriptolgy' by Petrowsky and Osborne. It's out of print and a little out of date, but it will help you with scripting. Unfortunately, you can't even get it on Ebay.

Steve

Link to comment
Share on other sites

This topic is 7229 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.