[|QR Code Generator|] Generator not working when trying to save image into database
Forge component by Tejas Mendse
Application Type
Reactive

Hello Tejas

Thank you for making this component available!

I was trying to use your QR generator, and although it generates a QR code, the generation fails when we call an action to save the code into the database.

I tried 3 different approaches and they all failed. 

1) Calling the CreateOrUpdate action directly in the same action where I call the QRCodeGeneration action


2) Calling the CreateOrUpdate action in a separate action


3) Encapsulating the CreateOrUpdate action in a client action and calling it separately


If I only generate the QR code (i.e. don't try to save it into the database) the generation works perfectly, but as soon as I try to save into the DB (even if I don't even call the action) the generation fails and no QR code is returned by your action

Is this something you can fix?

I'm using this in a reactive web app


Thank you in advance,

Ângelo

Hello Angelo,

I was able to successfully generate QR Code from the extension as well as save in DB.

I am attaching sample OML.

Please have a look.


Thanks,

Krunal

QRCode.oml

Hello Angelo

Generating the QR and Saving that into DB are separate things. Please take this into a Step wise approach. 

Either you can see if Krunal's OML gives you the correct way else please share what error you are facing while saving..  So, an appropriate solution could be shared 

Hello Krunal

Thanks for your response

The pattern that you share in your OML is exactly the same as I described on my second scenario above.

It does not work for me, and the only difference is that I'm trying to use this component in a reactive app, not a traditional one. I understand it can have an impact on saving the binary into the DB, but it seems strange to me that it fails to generate the binary even before I call the server to save it into the DB

Hello Angelo,

I tried the same implementation in Reactive web app as well and it works as expected.

Please find the OML for reference.

If you are getting any problem, Please share your OML or screenshots so we can understand more.


Thanks,

krunal

QRCodeReactive.oml

Hello Krunal

Thanks for your help

Please find attached my sample OML. If you go into debug, you'll see that BinaryData returned by the QRCodeGeneration action in the GenerateOnClick client action is empty (0 bytes). If you delete the SaveOnClick client action, then the returned BinaryData has content, which sounds very strange to me


I'm sure this is a pretty simple thing that I'm missing, but at first glance, it looks like it's similar to what you have

QRGeneratorAAS.oml

Hello @Ângelo Sousa ,

I have checked the oml and I am not seeing any issue while saving or rendering the image. PFA screen prints for the same. Also , the binary is getting stored in the db. i am not sure what issue you are facing since i am not able to reproduce it.

@Krunal Vyas/ @Manish Gupta  : could you please check at your end and provide confirmation whether it is working or not.


Hello Tejas

Yes, it's very strange. I just changed the logic on my OML so I don't show the QR code on the generate screen and it saves the code into the DB without an issue. 

i can show as well as save at the same time. No issue at my side.


Thanks,

Tejas

Hello Angelo,

yes its a very strange behavior and I was trying to rectify why this thing is happening by inspecting the OML.

If I get any findings will surely share.

Hope now you able to proceed with your task.


Thanks,

Krunal

Hello Krunal

Thank you. Were you able to replicate my issue?

We can continue with the task; we may only have a problem if we want to change the code and display the change immediately in the screen. But for now, we can keep working on it

Hello Angelo,

I was able to replicate the issue.

If we bind the local variable which we are using to save the QR code result to image widget.

The QR code is not generated.

As per my knowledge its happening because QR code is generated on server side and it cannot be directly bound to a UI component.

@Tejas Mendse You can try this scenario out.


Thanks,

Krunal

Hello Angelo,

You can check out other QR Code generators as well.

Which will serve your purpose.


Thanks,

Krunal


Hello @Krunal Vyas :

Here, I am using "GeneratedQRCode"variable to hold the response from QRGenration server action. Also, i have bind this variable to the image widget and im performing the save operation in the same action with the same variable. Again, I am not seeing any issue. PFA screen prints. Could you please create the  scenario where you are seeing the issue and share the oml so that i will be aware of the issue. could you please provide me in which sceneario the qr action is not generating the binary?


Hello Tejas,

Please find my OML where i was able to replicate issue.

I found out that issue persists when i use the local variable in entity action.

Please have a look


Thanks,

Krunal

QRCodeReactive.oml

Hello @Krunal Vyas ,

Thank you for sharing , i checked your oml, and qr code is getting generated on UI front and it is getting stored also. PFA screen print. i am still wondering what issue you guys are getting. But anyways, if you can point me or share the detailed steps then only i can do some thing. This oml response is the same that i shared in my previous post.

As you mentioned i am not seeing any issue with variable in entity action and it did saved the record. Also same variable is bound to UI. i have just debug your oml without any change and it is working fine.


Thanks,

Tejas

Hello Tejas

Sorry Mate, I was busy in something. I hope you got the answer for the item you asked me to confirm. Still may I help you with anything please?

Hello @Manish Gupta ,


Yes, Could you please download the oml shared by krunal and see if you are getting any issue while displaying or saving the record. Because i am not getting any issue but kraal is getting it. so just want to confirm if i am missing anything?


Thanks,

Tejas

Okay, I am looking into QRCodeReactive.oml. Is that correct to check? 

yes correct. please check if the qr code is displaying correctly and binary is getting saved.

Yes, working fine for me. QR Code Generated and Binary Data saved in the Entity I checked in Data Tab. 

Thank you very much Manish for the quick check.

@Krunal Vyas  : we are not getting any issue with the component or the oml that you have shared. Also , it is working fine for @Manish Gupta .

@Ângelo Sousa : we are not able to reproduce the issue which you are referring. If you have any oml from which you can show that component/or any use case  is not working then please share. Thank you all


Thanks,

Tejas


Hello All,

I find it a bit strange, why are we able to reproduce the issue and you guys are not able to.

Is there some other factor like component version, platform version effecting this.

I am also not sure.


Thanks,

Krunal

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.