QR code missing characters after printing with Zebra S4M - qr-code

I am programming a Zebra S4M template:
^FX[Fonts]^FS
^FX[Graphics]^FS
^FX[Format]^FS
CT~~CD,~CC^~CT~
^XA
^DFR:QR.ZPL^FS
~TA000~JSN^LT0^MNW^MTT^PON^PMN^LH0,0^JMA^PR3,3^MD10^LRN^CI0
^MMT
^PW980
^LL0461
^LS0
^FT137,424^BQN,2,7
^FN24^FDQR_CUST_CODE^FS
^XZ
The line in question is ^FN24^FDQR_CUST_CODE^FS, where the variable is supplied in a .xml file
<?xml version="1.0" standalone="no"?>
<!DOCTYPE labels SYSTEM "label.dtd">
<labels _FORMAT="R:QR.ZPL" _QUANTITY="1" _PRINTERNAME="Printer 1" _JOBNAME="LBL101">
<label>
<variable name="QR_CUST_CODE">11112345678</variable>
</label>
</labels>
The resulting code only contains values 12345678, so I am missing first 3x1.
Any suggestions? Tried to add QA to the FD but it does not work.

When creating a QR Code in ZPL, the ^FD command has additional arguments that must be set before the data is added.
Change your last line as show here:
From:
^FN24^FDQR_CUST_CODE^FS
To:
^FN24^FDMM,NQR_CUST_CODE^FS
Below is example from the BQ Command guide that should help you further.
https://support.zebra.com/cpws/docs/zpl/BQ_Command.pdf

Related

PHPUnit: Flat XML to BIT(1) is always 1

I am trying to run PHPUnit tests and I have a problem with putting a false (0) into a BIT(1) column.
My XML looks like (without pasting my entire XML File):
<!-- Panama -->
<ztest_user
id="3"
firstname="Eddie"
lastname="Van Halen"
password="dabac4cd92d71106e74406be137a578e1b3ce436420f66d2df5be458301d2154"
salt="zU`Rr$X=YjxHRp8o"
email="eddie#vanhalen.com"
roleid="2"
date_added=""
date_modified=""
enabled="1"
confirmed="0"
graduationyear="2020"
yearjoined="2019"
birthday="1955-01-26"
profileimageid=""
/>
When I run the tests, this entry gets put into the database as shown, except for the confirmed column, which gets a 1 instead of a 0.
My thoughts are that the BIT(1) column gets set if there is any data and not to what the value of confirmed actually is.
How should I go about fixing this?

Preventing automatic line break in xml on Atom editor?

Hello everyone.
I am new to Atom and using atom to see xml files. (I didn't setup any additional packages yet. Version 1.19.4)
One of my xml files consist of many attributes. For example..
<book id="test_xml">
<class name="First_row" attrib_01="Grape" attrib_02="Apple" attrib_03="banana" attrib_04="Water melon" attrib_05="Orange" ... (and so on )
</book>
Every has 50 attributes at least.
First time I opened this xml file in atom editor, It shows every class in single line. (This is what I want.) But when I edit attribute value ("Melon" to "Apple"), atom editor breaks the line suddenly and showed one line to multi line like belows.
<book id="Fruit">
<class name="First_row" attrib_01="Grape" attrib_02="Apple"
attrib_03="banana" attrib_04="Water melon"
attrib_05="Orange" ... (and so on )
</book>
Without changing xml format, how to prevent split the single line to multi line?
Thank you.

Accessing XML data in R that is several layers embedded

I'm working with a well-structured XML file. So far, I have successfully accessed elements of this dataset that are only one layer/subfield deep. However, now I need to access one type of data that is more deeply embedded within this data structure, and the expected method is not working...
Excerpt from the XML data; this is the "target" field that I need to access, where each node (i.e. drug) can have between 0 and N targets (I am arbitrarily setting N to 20 for now, since I'm not sure what this value is for the entire dataset):
<targets> --> 51st field in each node
<target> --> there are a variable number of targets per drug
<id>BE0000048</id> --> this is the value I want for each Target
<name>Prothrombin</name>
<organism>Human</organism>
<actions>
<action>inhibitor</action>
</actions>
<references>
<articles>
<article>
<pubmed-id>10505536</pubmed-id>
<citation>Turpie AG: Anticoagulants in acute coronary syndromes.
...
I have determined that the main Target field that I need is Field 51 within each node's structure, thus the hardcoded value below. I would think that accessing the i'th node's id value within the j'th target within the node's Target field should have an index of [[i]][[51]][[j]][[1]] or [[i]][[51]][[j]][['id']]:
This is my code that isn't working as expected:
Target <- array(1:NumNodes, dim=c(1,NumNodes,MaxTargets))
for (i in 1:NumNodes){
for (j in 1:MaxTargets){
Target[i][j] <- Data[[i]][[51]][[j]][[1]]
}
}
The behavior I'm seeing is that I can extend the subscripts out numerous levels on the command line, and never narrow the result any more than the following:
> Data[[1]][[51]][[1]][[1]][[1]][[1]][[1]][[1]][[1]][[1]]
[1] "BE0000048ProthrombinHumaninhibitor10505536Turpie AG: Anticoagulants...
It doesn't seem to matter how many subscripts I add; all of the fields in the Target subfield are always conjoined and don't seem to be able to be separated...
Confusingly, when I run my code, I get the following error message:
Error in Data[[i]][[51]][[1]] : subscript out of bounds
... which doesn't seem to make sense, given that I am limiting i to the number of nodes, and that there is no error thrown for even the ridiculously long list of subscripts show above, when I query that phrase on the command line...
Thanks in advance for any insights you can provide.
Thanks for your suggestion, cderv; I will plan to check out the xml2 package and XPATH. I really appreciate your willingness to provide an example.
I am pasting what should be a functional subset of my XML file; however, now instead of the "targets" field being the 51st field, it is the sixth. Again, it is the targets --> target --> id value that I want to report for each target, with each node having a variable number of target values. My code follows the XML content.
<?xml version="1.0" encoding="UTF-8"?>
<drugbank xmlns="http://www.drugbank.ca" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.drugbank.ca http://www.drugbank.ca/docs/drugbank.xsd" version="5.0" exported-on="2017-07-06">
<drug type="biotech" created="2005-06-13" updated="2016-08-17">
<drugbank-id primary="true">DB00001</drugbank-id>
<drugbank-id>BTD00024</drugbank-id>
<drugbank-id>BIOD00024</drugbank-id>
<name>Lepirudin</name>
<description>Lepirudin is identical to natural hirudin except for substitution of leucine for isoleucine at the N-terminal end of the molecule and the absence of a sulfate group on the tyrosine at position 63. It is produced via yeast cells. Bayer ceased the production of lepirudin (Refludan) effective May 31, 2012.</description>
<targets>
<target>
<id>BE0000048</id>
<name>Prothrombin</name>
<organism>Human</organism>
<actions>
<action>inhibitor</action>
</actions>
<references>
<articles>
<article>
<pubmed-id>10505536</pubmed-id>
<citation>Turpie AG: Anticoagulants in acute coronary syndromes. Am J Cardiol. 1999 Sep 2;84(5A):2M-6M.</citation>
</article>
<article>
<pubmed-id>10912644</pubmed-id>
<citation>Warkentin TE: Venous thromboembolism in heparin-induced thrombocytopenia. Curr Opin Pulm Med. 2000 Jul;6(4):343-51.</citation>
</article>
</articles>
</references>
<known-action>yes</known-action>
</target>
</targets>
</drug>
</drugbank>
Now that I have significantly truncated the above file, my code is now giving an error message that any subscripts above Data[[1]][[1]] are out of bounds, but hopefully this code gives you an idea of what I'm aiming to do...
library(XML)
# Save the database file as a tree structure
xmldata = xmlRoot(xmlTreeParse("DrugBank_TruncatedDatabase_v4_Tiny.xml"))
# Number of nodes in the entire database file
NumNodes <- xmlSize(xmldata)
MaxTargets <- 20
Data <- xmlSApply(xmldata, function(x) xmlSApply(x, xmlValue))
Target <- array(1:NumNodes, dim=c(1,NumNodes,MaxTargets))
for (i in 1:NumNodes){
for (j in 1:MaxTargets){
Target[i][j] <- Data[[i]][[5]][[j]][[1]]
}
}
Thanks for your input!

Why does my query report "Steps within a path expression must yield nodes"?

I'm relatively new to XQuery and I'm using a XML with the following format (MODSXML):
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<modsCollection xmlns="http://www.loc.gov/mods/v3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.loc.gov/mods/v3
http://www.loc.gov/standards/mods/v3/mods-3-0.xsd">
<mods ID="ISI:000330282600027" version="3.0">
<titleInfo>
<title>{Minimum Relative Entropy for Quantum Estimation: Feasibility and General
Solution}</title>
</titleInfo>
I'm trying to retrieva all titles of the articles contained on the XML file. The expression I'm using is the following:
for $x in collection("ExemploBibtex")/"quantuminformation.xml"/modsCollection/mods/titleInfo/title
return <title>$x/text()</title>
When I try to run this expression on Base, I get the following error:
"[XPTY0019] Steps within a path expression must yield nodes; xs:string
found."
Can anybody tell me what's wrong? The result I was expecting was a list with all the titles in the document.
Okay, problem solved in the BaseX Mailing List :D
I needed to declare the namespace. So now I'm using:
declare namespace v3 ="http://www.loc.gov/mods/v3";
for $doc in collection('ExemploBibtex')
where matches(document-uri($doc), 'quantuminformation.xml')
return $doc/v3:modsCollection/v3:mods/v3:titleInfo/v3:title/text()
And it works.
The problem is here:
collection("ExemploBibtex")/"quantuminformation.xml"/modsCollection
This returns a string with content quantuminformation.xml for each file/root node in the ExemploBibtex collection, and then tries to perform an axis step on each of these strings -- which is not allowed.
It seems you want to access to document quantuminformation.xml within the collection ExemploBibtex. To open a specific file of a collection, use following syntax instead:
collection("ExemploBibtex/quantuminformation.xml")/modsCollection
I cut of the last axis steps for readability and keeping the code lines short; simply add them again, they're fine.

XForms bind element error

I am changing my code to use binds in XForms (which is better practice than using nodesets everywhere!) but I am getting errors.
The error message I receive is: "Error: XForms Error (8): id (data_criterion) does not refer to a bind element..."
From tutorials/guides I have been using, it seems as though this should work, but clearly I am missing something! (btw, I was modeling my binding code after the examples here: http://en.wikibooks.org/wiki/XForms/Bind)
I originally thought the problem was due to the fact I was using xf:select controls as opposed to xf:input like the examples, but even once I dumbed down my code to the most simplistic code, I still receive errors!
This is the model code I am using:
<xf:model id="select_data">
<xf:instance id="criteria_data" xmlns="">
<file>
<criteria>
<criterion></criterion>
</criteria>
</file>
</xf:instance>
<bind id="data_criterion" nodeset="instance('criteria_data')/criteria/criterion"/>
</xf:model>
As for the ui code, this is what I have:
<xf:input bind="data_criterion">
<xf:label>Enter criteria:</xf:label>
</xf:input>
The error message I receive is: "Error: XForms Error (8): id (data_criterion) does not refer to a bind element..."
Anyone have any insight to what the problem is? Also, is there any special usage of bindings and xf:select (with xf:itemset) controls that I should be aware of? (I am ultimately using a lot of xf:select controls on my form..)
Thanks in advance!
EDIT:
I ran the code through this validator, and I got this message (refers to the bind line):
"Warning: Should the following element have the XForms namespace applied?: bind (line 66)"
A couple of things you might want to change:
Not sure of this is the reason for the error, but the nodeset expression should be instance('criteria_data')/criteria/..., without file. Remember: instance() returns the root element, not the document node. (This one you took care by updating the question; good)
You are missing the xf on the bind. It should be: <xf:bind id="data_criterion" nodeset="instance('criteria_data')/criteria/criterion"/>.
See below a full example with your code, which works fine for me under Orbeon Forms:
<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner">
<xhtml:head>
<xhtml:title>SO Bind</xhtml:title>
<xf:model id="select_data">
<xf:instance id="criteria_data" xmlns="">
<file>
<criteria>
<criterion>Gaga</criterion>
</criteria>
</file>
</xf:instance>
<xf:bind id="data_criterion" nodeset="instance('criteria_data')/criteria/criterion"/>
</xf:model>
</xhtml:head>
<xhtml:body>
<xf:input bind="data_criterion">
<xf:label>Enter criteria:</xf:label>
</xf:input>
</xhtml:body>
</xhtml:html>

Resources