I have extracted the bursting function out from Canvas, wrapped that around using Powershell, and integrate that to TM1Web, as I am not yet ready for a full blown Canvas application, letting users going into Canvas may scare them as nothing is there (not in scope), but I do need to bursting feature, and therefore using this trick.
However, now I need to do more processing after the burst, so I have written a TI process, trying to look for the last element of the subset that I am passing to Canvas, hoping that if I have found the last element, that would means all my files bursted properly, but unfortunately, it appears Canvas didn’t burst according to the order of the subset, and that would makes the code doesn’t work for me.
And I can see Canvas is not bursting in parallel, at least what it looks like to me from how the file has been generating, so it must be bursting in some kind of order, but what order is that? By Element Index? By Element Name? By Alias Name? Or just pure random?
Can you provide more information like how does the power shell script looks like? In particular, the Canvas section where you are doing this burst? And can you also give more information on how are you currently checking the last element of the subset that you are passing into Canvas?
I don’t think we can say that the second report from burst will start printing only after first report URL has printed, since all the URL calls go out in a sequence but the first report may take twice as long to print as second. So you will have the second report print first than the first report will print second.
Sometimes I would miss by 3~4 reports, I am already putting like 20 seconds sleep on my process, and “hoping” I will get all my reports printed, but I still miss, that’s why I am thinking maybe the order has something to do with it.
Basically on the Powershell, I am just calling Invoke-WebRequest and passing the taskId to another web service @rwang has written using Node.js with all the credential to login to Canvas.
On the TI, I am using SubsetGetSize to find the number of elements, and then use SubsetGetElementName to get the last element of the subset, and then based on the naming convention, I am using FileExists to check if the file has been produced on the print folder or not.
Like I said when I replied to @ishapiro, I would miss 3~4 sometimes, and I already have made it sleep for 20 seconds.
The elements itself are being retrieved as per order from TM1. However, as @ishapiro has an example for, the PDFs itself may take a while to print depending on the contents. In relation to this, the PDF generations are being generated by threads. So from that perspective, the sequence may not be as per the elements in a subset for example.
Have you tried doing a count instead? For example, if the contents of the subset is 10 elements, are you saving them into a specific folder? Then you can try via your scripting if the number of files in there is already 10.
Test it out first to gauge how long does it usually take. Then ideally use that on your shell script as a timeout / elapse time before checking if it is complete.
If you are expecting 10 and it only prints out 6 for example, then checkout the application.log. Any errors in there?
I do not want to rely on too many external code, especially for these checking, as I need to give the user a sense of “wait”.
TM1 itself does not have the function to count the number of files already exists in a folder, so therefore if I need to do that, I will need to maybe execute some batch file, read some text output and then loop itself, introduce way too many uncertainty, and this is why I am going for the route of checking last element.