Done Event - WeOnlyDo Discussion board

Done Event (wodFtpDLX / wodFtpDLX.NET)

by S Styer, Tuesday, June 10, 2014, 18:33 (3580 days ago)

I need certain things to happen after I transmit some files to an ftp site
the user is telling me... that if you go to another application
while the program is displaying the print message.... that it seems to
continue past that point. Just because they moved to Outlook... after doing a cut and paste
I'm trying to get the Done event... to wait
until all the steps are completed (printing, etc)
is it possible that it's jumping past that point?
can I hold the event at the messagebox?


int r, save_days
long i_row
string s_file, ls_part, trans_type, save_pool, v_other, out_dir, pdf_save, folder_path
double save_net
datetime save_date
time s_time

if errorcode <> 0 then
messagebox('ERROR',errortext)
close(parent)
return
end if
if p_state = 1 then
s_file = file_name + '.asc'
move_file = s_file
out_dir = '/Inbound/Encrypted'
p_state = 5
ole_ftp.object.putfile(s_file, out_dir )
return
end if
if p_state = 5 then
nbr_in_dw = dw_3.rowcount()
for i_row = 1 to dw_3.rowcount()
ls_part = dw_3.getitemstring(i_row,'pool_part_no')
trans_type = dw_3.getitemstring(i_row,"jpmc_transmit_rec_type")
s_time = now()
do until string(s_time,"ss") <> string(now(),"ss")
loop

if trans_type = 'F' then
save_net = dw_3.getitemnumber(i_row,'jpmc_transmit_net_pay')
save_days = dw_3.getitemnumber(i_row,'jpmc_transmit_days')

v_other = 'Pay ' + string(round(save_net,2)) + ' : Batch - '
else
v_other = 'Batch - ' + string(batch_id) + ' File - ' + mid(file_name, lastpos(file_name,"\")+1,len(file_name))
end if

dw_3.setitem(i_row,"jpmc_transmit_sent_date", d_time)
dw_3.setitem(i_row,"jpmc_transmit_sent_status",'S')
dw_3.setitem(i_row,"jpmc_transmit_batch_id",batch_id)
dw_3.setitem(i_row,"jpmc_transmit_file_name",hold_file_move)
next

If dw_3.Update() = 1 Then
if dw_hist.update() = 1 then
if dw_card.update() = 1 then
Commit;
else
messagebox('Error','Failed to Commit Card Data in Export Transmit')
rollback;
end if
else
messagebox('Error','Failed to Commit History Data in Export Transmit')
rollback;
end if
else
messagebox('Error','Failed to Commit Data in Export Transmit')
rollback;
End If

if nbr_in_dw > 0 then
dw_report.settransobject(sqlca)
dw_report.retrieve(batch_id)
if dw_report.rowcount() > 0 then
if messagebox('Question','Do you want to print a report of what was just sent?',Question!, YesNo!, 1) = 1 then
dw_report.print()
end if
dw_report.Object.DataWindow.Export.PDF.Method = Distill!
dw_report.Object.DataWindow.Export.PDF.Distill.CustomPostScript="No"
folder_path = 'C:\'
getfolder('Pick Path for PDF File',folder_path)
pdf_save = folder_path + '\jpmc_sent_' + string(batch_id) +
dw_report.saveas(pdf_save,PDF!, FALSE)
end if
end if
p_state = 7
filedelete(file_name)
ole_ftp.object.disconnect(true)
end if
if p_state = 7 then
messagebox('End','File successfully Completed')
p_state = 9
pb_cancel.triggerevent(Clicked!)
return
end if

Done Event

by wodSupport, Tuesday, June 10, 2014, 18:48 (3580 days ago) @ S Styer

Hi.

I am not sure what exactly is the problem, so let's try to isolate it.

Are you using Blocking mode? If so, Done event doesn't fire (or, you should not handle it), but after PutFile is called, component will block until it gets file transferred.

BTW if you are using events, you should not 'sleep' or 'hold' them, because other windows messages may be arriving, and it is possible, in theory, that your programming environement will 'jump over' them.

So let's see how to change the code to make this work. What happens after the 'Done' event?

Kreso

Done Event

by S Styer, Tuesday, June 10, 2014, 19:33 (3580 days ago) @ wodSupport

I'm using
ole_ftp.object.blocking = 0

I was thinking that there was a requirement, to do the blocking in this way

I create a file
sign/encrypt it, using gpg
and put the file on to a secure ftp site

once done... I'm updating the records that were used to create the file
with a sent status
and printing out a report
remove the local file
and, disconnect

if it failed to send the file... or, the other steps
we could resend the same records

it's initially called from a click event from a button
if wf_sign_file() = true then
if wf_transmit() = true then
end if
end if

the wf_transmit function does the initial connection
the done event... has different stages... of the process
because I know, that certain things fire the done event

Done Event

by wodSupport, Wednesday, June 11, 2014, 00:11 (3579 days ago) @ S Styer

Hi.

I still don't understand what exactly happens, and what does it mean 'goes by certain point'.

You're using wodFtpDLX client, in async mode. It uploads a file, and when it completes, Done event fires.

So, what happens now? It finished it's job? Did event fire? What exactly is wrong, can you explain in some different word, or describe scenario, in steps, that you're experiencing?

Kreso