generation of many qr code in a loop - Forum

Forum Navigation
You need to log in to create posts and topics.

generation of many qr code in a loop

Hi,
I'm using the plugin (neoQR) for generating QR codes.
I have a table (neotable) with some data ([JsonAcquisitori4QR]) inside and then when I click on a row I see details of that row and I generate a QR code with some data and I show it in a container.
Then I can retrieve the image of the QR code in base64 thanks to ImgToBase64Png, indicating the container and 'img'. So far everything ok.
Then I written a procedure that scrolls the source json object (that of the table) with a loop to generate all the QR codes of all the rows (to be able to insert them  in a pdf) in this way:

neoTableGetAllData "Container_Acquisitori" [JsonAcquisitori4QR]

LoopObject [count4QR] [JsonAcquisitori4QR]
   setvar [produttoreAcquisitori4QR] [JsonAcquisitori4QR([count4QR]).Produttore]
   setvar [modelloAcquisitori4QR] [JsonAcquisitori4QR([count4QR]).Modello]
   setvar [serialeAcquisitori4QR] [JsonAcquisitori4QR([count4QR]).Seriale]
   setvar [afferenzaAcquisitori4QR] [JsonAcquisitori4QR([count4QR]).Sede_Afferenza]

   ...CREAZIONE QR CODE per ogni dispositivo in lista
   setvar [QRCodeText_Hidden] "dbs|2|Acquisitore|[produttoreAcquisitori4QR]|[modelloAcquisitori4QR]|[serialeAcquisitori4QR]|[afferenzaAcquisitori4QR]"
   neoQR "Container_QRAcquisitore" "[QRCodeText_Hidden]" "" ""

   ...Recupero immagine del QR code
   ImgToBase64Png "Container_QRAcquisitore img" [base64DataQR_Acquisitore_hidden]
   ..jsalert [base64DataQR_Acquisitore_hidden]
   Consolelog [base64DataQR_Acquisitore_hidden]

EndLoop

but sadly what works in a single step doesn't work in the loop. Ie ImgToBase64Png "Container_QRAcquisitore img" [base64DataQR_Acquisitore_hidden] returns 'data :,' in Console
I hope I was clear.

Suggestions?
What's wrong with the loop?

 

Greetings

Rocco

@roccocogliano probably the loop is looping too quickly so there is no time to generate the QR code and get the Base64 encoded image from one loop to the next one. Try using a Timer object or a SetInterval Command to loop through the JSON object.

Regards.

roccocogliano has reacted to this post.
roccocogliano

yes, that's right, it's likely.

Thank you so much

luishp has reacted to this post.
luishp