Javascript not working in mobile app, but works in mobile emulator

Hi,

I have a javascript code that works in the mobile emulator, but doesn't work in the mobile app. Within the code itself i'm breaking down an array and sending this to a client action.  I've included a basic oml example and a screen image for reference.  I've simplified 'var needproduct', as the actual array comes from a cordova plugin. 

When debugging it references to deprecation; not sure if this is associated with the problem or not. 

Any thoughts on the problem and steps to fix are appreciated.  Thanks!


 

Hi Bradford,


First off, you are doing something really funky with that UsersList in the screen action "ListProducts".  Probably an artefact of quickly putting together a demo app ... Not sure what the purpose even is, since you don't do anything with the user (it's not related to product or anything)  Anyway, you have a ForEach that starts at Current userid, so if there is a user logged on, this will be a value larger then 0, will never iterate even once (since there is only one item in your list, at index 0) and no products will be created.



So if I remove all this logic, and just simply create a Product in ListProducts, then I can see what you are talking about.  In emulater, 3 products are shown on the second screen, on my mobile, none are.


So out of curiosity, I added a createProduct right after the Javascript bit, hoping to at least see this one show up i in the list.  To my surprise, now suddenly those created from inside the Javascript bit also turn up !

See attached oml, you can test it : I added a checkbox, if it is checked, then an extra product is added and immediately deleted, and all the ones added from inside the javascript bit are there !


So, this could be your workaround, but maybe could be reported to OS, it feels like a bug to me.

Let me know if this solves your problem in the real project,

Dorine

Variables You don't use are optimized away by OutSystems. At least those kind of optimisations exist for web, probably also for mobile.

Hi, Dorine Boudry, Wow, Spot on, That worked.  Hopefully it works in the final build as well.  I'll let you know if there are any issues.  Thank you for quick and detailed reply.  Much appreciated!

Hi Daniël Kuhlmann, Thank you for the clarification.