Page 1 of 1
Profound UI mobile client
Posted: Tue Dec 20, 2016 3:37 pm
by Paul_Ramcharitar
Hi,
I am using the profound ui mobile client to run programs. However, it is noticed that images loaded from the IFS via image widget for example, are not coherent with the latest version of the image stored.
I have to go into "app info" then "clear data" for the correct images to be loaded.
How can I allow the mobile client to load the latest version of the image?
Re: Profound UI mobile client
Posted: Tue Dec 20, 2016 9:17 pm
by Scott Klement
Web browsers (including the mobile client) cache images for performance sake. The result is that you'll get an old copy of the image unless you do something to avoid that.
Try setting your image source property to something lke this:
Code: Select all
script: pui.normalizeURL("/tempimages/" + get("PATID") + ".jpg?rnd=" + Math.random());
Naturally the URL to your imge will be different, mine is /tempimages/XXXXX.jpg (where XXXXX is a patient id number). This code adds ?rnd=YYYYYYYYY (where YYYYYYYY is a random number) to the end of the URL. Because the ? was added, it won't consider the rnd= part of the filename... but the fact that the URL changes each time will prevent the browser from caching it.
Hope that helps
Re: Profound UI mobile client
Posted: Wed Dec 21, 2016 2:49 pm
by Paul_Ramcharitar
Hi Scott,
The image url is set in the program via binded image source property. I decided to use the RPGLE rand() function
Code: Select all
rnd_num = '?rnd='+%char(Rand());
phot_src2# = %TRIM(DUCSRCDIR) + %CHAR(cmnumb#) + %trim(DUCSUFFIX)+rnd_num;
It is working in the web browser however, the image still does not change in the mobile client.
Re: Profound UI mobile client
Posted: Wed Dec 21, 2016 3:00 pm
by Scott Klement
Are you returning to the RPG program and updating the image URL with a new random number each time you want the image to re-load from the IBM i? If so, what you're doing should work fine.
Re: Profound UI mobile client
Posted: Wed Dec 28, 2016 2:41 pm
by Paul_Ramcharitar
I got it. I had to seed the random number using srand.
Thanks Scott.