General outlook:
for a report I take a picture and want to save in /APP_ROOT/Pictures/tmp
When I'm satisfied of the report and the picture, I move it from tmp to Pictures and then I create a thumbnail making a copy and resize the copy.
what happen is that the picture will be shown as partially black
from my understanding of using async blocks (large files) these are background process and may be the refresh time of a page/layout is faster then the image manipulation itself.
Moving from this assumption, I saw somewhere clock.time_enable option to be used. I couldn't get the real way of how it work but again my understanding is that enabling the clock it counts the time for completion of a function and when process is completed clock return some green light to proceed with the code execution.
I might be conpletely wrong and please share some hints
at the same time, to shorten the process is it possible to define a default image directory rather the app root directory? in this way I'll avoid save and copy at first time
as @TIMAI2 already mentioned, the async procedures require you to use their corresponding event, which fires after the action (move or copy) has finished...
continue with your logic there...
as you are using the blocks, you are already doing something before the move or copy process has been finished, which results in unexpected results like
@TIMAI2 thanks for highlighting the event. When I read the description of the extension I was still at the beginning of learning curve and did not get all details.
On the other hand now things are getting a little more complicated.
These move/copy/resize actions are in a if...then...else if...else loop inside a *.click event. The construction is that I have a form with 3 checkbox. the action of the *.click event depend on the checkbox selected (the if..then..else loop). the process is such that when I'm satisfied with my reports (including the picture), I move the chosen picture to the main Pictures folder (then create a thumbnail) and I delete all files (if any) in the Pictures/tmp directory
with my knowledge, I can't see how I can nest the *.moved event inline with the if..then..else loop.
Is the only workaround that I have to fork the if..then..else loop with a chain of *.moved events? I think doable but will bring some complexity in the understanding of code expecially if there is no way we can insert some note/comment
I keep thinking about other ways of programming and leads are as always welcome
EDIT: I just have seen, you later use MoveAsync and CopyAsync again...
There are 2 methods to solve this:
Drag another TaifunFile extension into the working area to get TaifunFile2
Then use the TaifunFile2.AfterMove and AfterCopy events accordingly
Alternatively use a global variable to identify, if you are using the first MoveAsync block or the second, then in the AfterMove event use an if statement like this
If myVariable = 1
Then do some processing for 1
Else do sone processing for 2
I also do not see you using the ListFixer block on your query output. This is requried for query returns of more than one column (in the documentation for SimpleSqlite, which you need to read)
@Taifun
I'm not sure I got Ur suggestion #2. I like the 2 instances which eventually might speed up the process (2x3 background operations) rather then have 6 consecutive ones.
Just because at the end of each THEN...ELSE IF...ELSE statement I need to update a table with the picture, I'm considering to use a TRUE/FALSE variable at the end of thumbnail creation. The question is how can I put the completion of the LOOP statement in hold until both booleans will be true?
What does the clock.enable:true/false does? Where can I find more info? There is not much in the extension help
@TIMAI2 . You r correct about lack of understanding of sqlite extension which started from the use of JSON. Everything grow unexpectedly and at the moment I'm trying to create a working app to show the potentialities and consider different functions. I'll need to revise several aspects of the app including this one. By all mean thanks for checking in because any feedback is really valuable to me
I will provide some extra blocks about my ideas asap
Let me suggest to keep it simple and not to do several things in parallel
Here is a pseudo code, which shows how to use a global variable together with several asynchronous methods and their corresponding events
Set myVariable to 1
Move receipt picture from A to y B
AfterMove
If myVariable = 1
Then set my Variable to 2
Copy thumbnail receipt from B to C
Else If myCariable = 3
Then set my Variable to 4
Copy thumbnail item from B to C
AfterCopy
If myVariable = 2
Then set my Variable to 3
Resize receipt thumbnail picture
Move item picture from A to B
Else if myVariable = 4
Resize item thumbnail picture
Continue with further synchronous processing