jwhittaker Posted April 12, 2011 Share Posted April 12, 2011 (edited) I'm trying to create QR codes with the entire address. I'm using the QR Contact Information in the text rules. My data is broken up using an address1field, cityfield, statefield, and a zipfield. I converted the rule to Javascript and saw the link to the MECARD phonebook registration link. I went there and saw that you can have multiple fields divided by commas to separate the house number, city, prefecture, and zip code. How can I create this address so the city, state, and zip fill in the contact? You can only select one rule or field in the QR Contact Information rule. I tried creating a separate rule combining all the pieces of the address into one field separating each with a comma, but it puts all of the info into the address field instead of the city in the city, state in the state and zip in the zip. I also tried to edit the javascript by adding the city state and zip as separate variables and adding them to the ADR: section separated by commas as well as adding another line for the ADR: and adding just one variable. Both of the ADR: things I tried only gives the zipfield info. Anyone else have an idea how to do this? Also I noticed that the QR codes don't do tagged text. I have tried using a <br> as well as a convert phone number to ***.***.***x rule and the <br> shows up as text and the format for the number is not there. This is the code for the combining of the address: var address = (Field("Address1") + "," + Field("City") + "," + Field("State") + "," + Field("Zip")); return address; The result of this is "1935 Cordell Court,El Cajon,CA,92020" all in the address with nothing in the city state or zip of the contact. This is the code for adding to the ADR: The result of this is just the zipcode. I think the problem/solution is in the code highlighted in red, but I don't understand it. var NameFieldOrRule = "Logo"; var PhoneFieldOrRule = "Phone1Rule"; var EmailFieldOrRule = "Email"; var WebsiteFieldOrRule = "websiteRule"; var Address1Field = "addressRule"; var cityField = "City"; var stateField = "State"; var zipField = "Zip"; var BirthdayFieldOrRule = ""; var NoteFieldOrRule = ""; var PointSize = "3"; // MECARD format // http://www.nttdocomo.co.jp/english/service/imode/make/content/barcode/function/application/addressbook // Also see: http://code.google.com/p/zxing/wiki/BarcodeContents var info = { N: FieldOrRule(NameFieldOrRule), TEL: OptionalFieldOrRule(PhoneFieldOrRule).replace(/\D/g,''), EMAIL: OptionalFieldOrRule(EmailFieldOrRule), URL: OptionalFieldOrRule(WebsiteFieldOrRule), ADR: (OptionalFieldOrRule(Address1Field), OptionalFieldOrRule(cityField), OptionalFieldOrRule(stateField), OptionalFieldOrRule(zipField)), BDAY: OptionalFieldOrRule(BirthdayFieldOrRule), NOTE: OptionalFieldOrRule(NoteFieldOrRule), } var result = ""; for (var label in info) { if (!info[label]) continue; result += label; if (!label.match(/\:$/)) result += ":"; result += info[label]; result += FusionPro.inValidation ? '\r' : ';'; } if (FusionPro.inValidation) return result; var QR = new QRBarcode; QR.pointSize = Int(PointSize) || 10; return QR.Make("MECARD:" + result + ";"); Edited April 12, 2011 by jwhittaker Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted April 12, 2011 Share Posted April 12, 2011 That code in red is boilerplate and shouldn't be changed from what's in the XML template rule. All you need to do is specify the information in that "info" block correctly. I think that you need to change the line that starts with "ADR: (OptionalFieldOrRule" to this: ADR: (Field("Address1") + "," + Field("City") + "," + Field("State") + "," + Field("Zip")),But there's an even simpler solution. Since you already have a rule that builds up the comma-delimited address like this: var address = (Field("Address1") + "," + Field("City") + "," + Field("State") + "," + Field("Zip")); return address;You can simply select the name of that rule (whatever its name is, probably something like "Address") in the "QR Contact Information" XML Template rule, without having to convert it to JavaScript at all. Quote Link to comment Share on other sites More sharing options...
jwhittaker Posted April 13, 2011 Author Share Posted April 13, 2011 Hey Dan Thanks for your reply. I did try both of those options before. I tried your first suggestion first and it would just import the entire text string into the street address without putting the city, state and zip into their own sections in the contact. I then created a variable to combine the entire address separated by commas like your second suggestion. Same results. I then created a rule combining the entire address and then calling it in the ADR: (OptionalFieldOrRule). Same results again. My client says it needs to work on an iphone. The MECARD format should be the right format. Does Printable support any other format for this? (VCard?) Jon Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted April 13, 2011 Share Posted April 13, 2011 I did try both of those options before. I tried your first suggestion first and it would just import the entire text string into the street address without putting the city, state and zip into their own sections in the contact. I then created a variable to combine the entire address separated by commas like your second suggestion. Same results. I then created a rule combining the entire address and then calling it in the ADR: (OptionalFieldOrRule). Same results again. My client says it needs to work on an iphone. Well, it might depend on the barcode scanner app. This stuff about encoding contacts is more of a convention than a standard, and some apps work better than others. If you want to post a sample of a barcode that's being generated, I can try scanning it with some different apps and see what they show. Better yet, ask your client to provide an example of a barcode that does scan in the entire address on his iPhone, and then we can look and see how it encodes it and write a rule to match that. The MECARD format should be the right format. Does Printable support any other format for this? (VCard?) It's not really a matter of what formats we (Printable) support per se. You can encode anything you want in the barcode. However, if you search this forum for "vCard" you'll find this example: http://forums.printable.com/showpost.php?p=7336&postcount=3 Quote Link to comment Share on other sites More sharing options...
jwhittaker Posted April 14, 2011 Author Share Posted April 14, 2011 Ok thanks. I'll contact them. Quote Link to comment Share on other sites More sharing options...
mgalligar Posted June 17, 2011 Share Posted June 17, 2011 Dan, I have the same problem as above, but I decided to let that go, at least i got all my data into the code. Then I had a much more serious issue. I did all my work using FusionPro Desktop 7. When I was done, I copied the template to a web server where it will be composed by FusionPro Server 6. I tested the web site & Server 6 is sending an error message: "QR Contact Information, line 15: ReferenceError: FieldOrRule is not defined". I even went back & deleted my "hand written" code and used the one supplied by FusionPro just the way it is supplied it. I used the drop down to put an address in the code. No problem (on desktop)! When I put it on the web site and tried to compose it there, I got the same error. Is there any way to resolve this? Thanks mgalligar Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted June 17, 2011 Share Posted June 17, 2011 DI did all my work using FusionPro Desktop 7. When I was done, I copied the template to a web server where it will be composed by FusionPro Server 6. That's not supported. You can't compose jobs made with newer versions of the FusionPro Desktop design tool on older versions of FusionPro Server. Quote Link to comment Share on other sites More sharing options...
-Lisa- Posted June 21, 2011 Share Posted June 21, 2011 I did try both of those options before. I tried your first suggestion first and it would just import the entire text string into the street address without putting the city, state and zip into their own sections in the contact. I then created a variable to combine the entire address separated by commas like your second suggestion. Same results. I then created a rule combining the entire address and then calling it in the ADR: (OptionalFieldOrRule). Same results again. My client says it needs to work on an iphone. The MECARD format should be the right format. Does Printable support any other format for this? (VCard?) Hi Dan, I'm having the same problem indicated above. The address is just not breaking out into their respective fields (Address, City, State, Zip) when the barcode is scanned. I've tried this on Andriod devices, Blackberries, and iPhones using a number of different scanner applications. I can probably get away with this for now but would love to know if there's a fix for this being worked on... Thanks! Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted June 21, 2011 Share Posted June 21, 2011 I'm having the same problem indicated above. The address is just not breaking out into their respective fields (Address, City, State, Zip) when the barcode is scanned. I've tried this on Andriod devices, Blackberries, and iPhones using a number of different scanner applications. I can probably get away with this for now but would love to know if there's a fix for this being worked on... And my response is the same as indicated above: http://forums.printable.com/showpost.php?p=7601&postcount=4 Specifically, as I said in my previous post, if you have an example of a barcode which does correctly scan and populate a contact, with all the separate address fields, I'd be happy to take a look at it, see what data it's encoding, and create a rule which encodes things the same way. However, many devices are simply not able to import distinct address fields into a contact from a barcode scanning app: http://stackoverflow.com/questions/4113836/qr-code-import-of-vcard-does-not-separate-fields-is-it-the-format And there's nothing at all that can be changed in FusionPro or your barcode rule to fix that. If there's a bug to be fixed, it's probably in either the scanning software or the API on your device (phone). But again, feel free to prove me wrong. Find a barcode which does scan correctly and I'll be happy to see what it's doing and create a rule for FusionPro to do the same. The problem is that this QR barcode stuff is still an emerging technology, and the MECARD standard is not very well enforced, so different devices will interpret the scanned barcode data differently, and will also have different capabilities for adding information to contacts. That said, here's the published MECARD standard: http://www.nttdocomo.co.jp/english/service/imode/make/content/barcode/function/application/addressbook It says that the components in the address field should be delimited with commas. So if you do that, it should work, if the scanning software follows the standard and your device can actually import the separate address fields into a contact. You can always set up another rule to concatenate things with commas, which JavaScript makes really easy as the default representation of an array, like so: // Works exactly as-is with the Cell Phone Tutorial: return [ Field("Add1"), Field("Add2"), Field("City"), Field("State"), Field("Zip") ];Then you can select that rule, by name, in the "Address (optional)" drop-down list in the QR Contact template rule. This should create the address field in the MECARD data in a way which matches the standard. That's about as much as FusionPro can do on its end; the rest is up to the scanning software and the device. Also see: http://code.google.com/p/zxing/wiki/BarcodeContents Finally, I'll note that in FusionPro 7.2, a built-in template rule has been added to create a QR barcode with contact information encoded in the vCard format, which encodes addresses slightly differently. You may have better luck with that, although support for vCard may actually be more limited among devices than MECARD. But this is all changing quickly. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.