Page 1 of 2

Possible bug calling a dynamic pff

Posted: December 14th, 2019, 7:00 am
by Mariovaisman
Hello,

Will try to explain what is occuring in some cases when a menu program calls other cspro program.

When the menu program generates a .pff file, then close it, and calls immediately the execpff with that file generated, sometimes (not always), the program doesn't start. But when execute again, it starts fine.
What I found. When I saw the pff file generated from the first execution, it was not completed, like it didn't have time to save completely the file before the execpff tried to use it.

Now, if I add a couple of instructions between close(<file>) and exeppff(<file generated>, stop) like do varying i=1 until I>1000 enddo; could complete the close instruction and then the execpff works perfect.
As I commented before, if I do the process twice, then the pff file created is completed.
The main change from previous applications was that in the created pff, added "ShowInApplicationListing=Never"
It seems that the "close(<file>)" requires a bit more time to finish the execution and it is not completed when the app uses that file immediately.

Thanks

Mario

Re: Possible bug calling a dynamic pff

Posted: December 16th, 2019, 7:03 pm
by aaronw
Not sure what the issue might be. Could you include the snippet of logic that launches the application and I'll try to replicate. Does this occur on Windows and/or Android?

Re: Possible bug calling a dynamic pff

Posted: December 17th, 2019, 9:02 am
by Mariovaisman
It happens only in android. The app in windows works fine. I think it is a time problem, where the close didn't finish before the next instruction starts ro be executed.

If I add a single insteuction between the close and the execpff, then it works fine.

Thanks

Mario

Re: Possible bug calling a dynamic pff

Posted: December 17th, 2019, 9:08 am
by Mariovaisman
The following are the instructions I was using.
---------------------------------------------------------------
setfile( piffile, "../application.pff",create);
FileWrite( piffile, "[Run Information]" );
FileWrite( piffile, "Version=CSPro 7.3" );
FileWrite( piffile, "AppType=Entry" );
FileWrite( piffile, "[DataEntryInit]" );
FileWrite( piffile, "ShowInApplicationListing=Never" );
FileWrite( piffile, "FullScreen=Yes" );
FileWrite( piffile, concat( "OperatorID=", "Dontknow"));
FileWrite( piffile, "StartMode=ADD;");
FileWrite( piffile, "Lock=Modify, Verify" );
FileWrite( piffile, "Fullscreen=Yes" );
FileWrite( piffile, "NoFileOpen=Yes" );

FileWrite( piffile, "[Files]" );
FileWrite( piffile, "Application=./enumerator/enumerator.ent" );
FileWrite( piffile, "InputData=./enumerator\dummydat.dat");
FileWrite( piffile, "[ExternalFiles]" );
FileWrite( piffile, "INTERV=./Ref/interv.dat");
FileWrite( piffile, "CLUSTERS=./Ref/CLUSTERS.dat");
FileWrite( piffile, "[Parameters]" );
close( piffile );

// instruction added
do varying i=1 until i > 10000;enddo;

execpff("../application.pff",stop);
stop(1);
-------------------------------------------------

Thanks

Re: Possible bug calling a dynamic pff

Posted: December 18th, 2019, 2:20 pm
by aaronw
I wasn't able to replicate the issue. Have you noticed this on more than one device?

Also, going forward you should check out the PFF object. It's nice, because it allows you to minimize the amount of logic you're writing to launch an application. The static PFF options can be saved in the PFF file. Then you load the PFF file and just write logic for the dynamic PFF options.

Re: Possible bug calling a dynamic pff

Posted: December 18th, 2019, 2:56 pm
by Mariovaisman
It happened in more than one device, most of them samsung in different models. I didnt use the pff object before and the app is the same used before. Will convert to object and see.

Re: Possible bug calling a dynamic pff

Posted: January 24th, 2020, 5:15 pm
by titeuf
Hi team, I think I had pretty much the same problem using OnExit. From a "Menu" application, I put in the launch program of the secondary application, for example "Menage.pff", the OnExit code but this does not work properly. I tried to modify directly "Menage.pff" also by putting in ADD-> OnExit the application "Menu.pff" but nothing. I also tried to work around with Execpff but the "Menu" application is not launched.
A better solution if possible.
Thank you !

Re: Possible bug calling a dynamic pff

Posted: January 27th, 2020, 8:13 am
by josh
If OnExit is not working in the pff then most likely the path to the pff to launch is incorrect. The OnExitOff in Menage.pff must be the relative path to Menu.pff. The best way to make sure the path is correct is to edit Menage.pff using the pff editor (right click on Menage.pff and choose edit...) and in the pff editor add the OnExit and click on the folder icon next to it and browse to the Menu.pff.

Re: Possible bug calling a dynamic pff

Posted: January 27th, 2020, 10:53 am
by titeuf
Hi Josh, thanks for the feedback. I also did this method by editing "Menage.pff" but I still have the same problem. At the end of data collection on "Menage.pff", I have to click on the "Back" button on the tablet to launch "Menu.pff".
Thx !

Re: Possible bug calling a dynamic pff

Posted: January 27th, 2020, 8:59 pm
by josh
Where do you hit the back button from? From the case list screen? If all you do is add the onexitpff in Menage.pff then after completing a case in Menage.pff CSEntry will display the list of cases for Menage.pff (the case listing screen) along with the big green plus button to add a new case. From there if you hit the back button it will launch the onexitpff. If you want to skip the case listing screen and go directly back to the menu you need to check the option to lock the case listing in Menage.pff.