No edit summary |
m (Hans moved page QR code to QR and barcode) |
(No difference)
|
Revision as of 13:40, 9 February 2020
To get the functionality to generate QR codes in Turnkey follow this pattern:
Add a class ZXing (this is the open source QR-code library we use, credits go to everyone involved in that). Add a static method with this signature QRImage(width:Integer; height:Integer; value:String):Image – and then you have access.
In the application (a returns and reclamation system) where this was used first we added a derived attribute like so:
QRCode: Blob , DerivationOcl = ZXing.QRImage(300,300,’https://reklamation.azurewebsites.net/MDriven/DisplayWithVariables?view=TestQRCodeFromVariable&id=$null$&vLopnummer=’+self.Lopnummer.asstring)
The Method must be marked with Tagged Value : Eco.ExternalLateBound = AnyValue
Let me explain the Ocl a bit:
ZXing.QRImage(300,300, theUrl) – this calls the static method QRImage on class ZXing, stating that the QRCode should be 300×300 pixels – in order for this to be legal in Ocl we must have the QRImage method marked as IsQuery.
From 2020-02-09 you can also do EAN13 barcodes.
To do a an EAN13 barcode you need a string of 12-numbers between 0-9, and the last 13th checksum digit will be added - or a 13-numbers string where the last digit is the correct checksum.
In the ZXing class add a method just like the QRImage above but call it BarcodeImage.
Using it in a viewmodel:
will give you this result: