QR and barcode
No edit summary
(Automatically adding template at the end of the page.)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
To get the functionality to generate QR codes in '''Turnkey''' follow this pattern:
Follow this pattern to get the functionality to generate QR codes in '''Turnkey''':


(please note, does not work in a [[Serverside actions|serverside]] job)
(Please note: this does not work in a [[Serverside actions|serverside]] job.)
[[File:2018-07-29 12h32 21.png|none|thumb|577x577px]]
[[File:2018-07-29 12h32 21.png|none|thumb|577x577px]]
Add a class ZXing (this is the open source [https://zxingnet.codeplex.com/ 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.
Add a class ZXing (this is the open-source [https://zxingnet.codeplex.com/ QR-code library we use], credit goes to everyone involved in that).


In the application (a returns and reclamation system) where this was used first we added a derived attribute like so:
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 first used, we added a derived attribute like this:
  QRCode: Blob , DerivationOcl = ZXing.QRImage(300,300,’https://reklamation.azurewebsites.net/MDriven/DisplayWithVariables?view=TestQRCodeFromVariable&id=$null$&vLopnummer=’+self.Lopnummer.asstring)
  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
  The Method must be marked with Tagged Value : Eco.ExternalLateBound = AnyValue
Let me explain the Ocl a bit:
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.
ZXing.QRImage(300,300, theUrl)  – this calls the static method QRImage on class ZXing, stating that the QRCode should be 300×300 pixels. For this to be permissible in OCL, we must have the QRImage method marked as IsQuery.


== From 2020-02-09 you can also do EAN13 barcodes. ==
== From 2020-02-09, You Can Also Create 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.
To make 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.
In the ZXing class, add a method just like the QRImage above but call it BarcodeImage.
[[File:2020-02-09 14h24 57.png|none|thumb|1168x1168px]]Using it in a viewmodel:
[[File:2020-02-09 14h24 57.png|none|thumb|1168x1168px]]Using it in a ViewModel:
[[File:2020-02-09 14h28 51.png|none|thumb|440x440px]]
[[File:2020-02-09 14h28 51.png|none|thumb|440x440px]]
will give you this result:
will give you this result:
[[File:2020-02-09 14h34 15.png|none|thumb|594x594px]]
[[File:2020-02-09 14h34 15.png|none|thumb|594x594px]]
[[Category:MDriven Turnkey]]
[[Category:MDriven Turnkey]]
{{Edited|July|12|2024}}

Latest revision as of 15:45, 10 February 2024

Follow this pattern to get the functionality to generate QR codes in Turnkey:

(Please note: this does not work in a serverside job.)

2018-07-29 12h32 21.png

Add a class ZXing (this is the open-source QR-code library we use, credit goes 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 first used, we added a derived attribute like this:

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. For this to be permissible in OCL, we must have the QRImage method marked as IsQuery.

From 2020-02-09, You Can Also Create EAN13 Barcodes.

To make 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.

2020-02-09 14h24 57.png

Using it in a ViewModel:

2020-02-09 14h28 51.png

will give you this result:

2020-02-09 14h34 15.png
This page was edited 97 days ago on 02/10/2024. What links here