PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → Problem with HFSQL scheduled task
Problem with HFSQL scheduled task
Débuté par Thomas Soegiarto, 17 avr. 2021 09:04 - 3 réponses
Membre enregistré
3 messages
Posté le 17 avril 2021 - 09:04
Hi.. I'm trying to create a scheduled task to send a notification every 10 minutes in the HFSQL control center. The stored procedure is tested and functional. Also, no errors occurred the test. But when I run this scheduled task on HFSQL it can't even send a single notification. Is there anyone who can help me?

IF NOT HFileExist(sm_paramedic) THEN
IF NOT HDeclareExternal(".\sm_paramedic.fic", "paramedic") THEN
RESULT HErrorInfo()
END
END
HDeclareExternal(".\sm_paramedic.fic", "paramedic")
IF ErrorOccurred = True THEN
RESULT(HErrorInfo())
END

IF NOT HFileExist(NotificationDoctor) THEN
IF NOT HDeclareExternal(".\NotificationDoctor.FIC", "NotifDoctor") THEN
RESULT HErrorInfo()
END
END
HDeclareExternal(".\NotificationDoctor.FIC", "NotifDoctor")
IF ErrorOccurred = True THEN
// Error while declaring the file, display the error
RESULT(HErrorInfo())
END

HReadSeek(sm_paramedic,sm_paramedicID,178)
ExpDate is string = DateToString(sm_paramedic.sm_paramedicSTRExpDate, "DD/MM/YYYY")
NotificationDoctor.sm_paramedicID = sm_paramedic.sm_paramedicID
NotificationDoctor.Subject = "STR Expiry in 1 months"
NotificationDoctor.Description = "STR Expiration on " + ExpDate + ". This notification just to warn you to renew your license!"
NotificationDoctor.DateCreated = Today()
NotificationDoctor.TimeCreated = Now()
HAdd(NotificationDoctor)
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 17 avril 2021 - 18:40
Hi

I'm interesting about this it could help me but correct me if I'm wrong

I only see on the fractment of the code that you create a table .fic then you will add info on that table
Do you use a Trigger to send the notification?
Or with the server on HFSQL use a scheduled task to execute the stored procedure?

I know that the stored procedure of HFSQL only will execute if a project execute it (I really wish I know a way to execute it alone without this)
Do you try to execute the stored procedure with only the timer of HSQL?

Hope we can figure this out this could help you, help me and help everyone else.

--
Best Regards
ARV
Membre enregistré
3 messages
Posté le 19 avril 2021 - 04:53
Hi ARV, Thank you for the response. I don't use Trigger to send notifications. I only use "schedule a task" directly on the HFSQL server where the timer is set every 10 minutes. I've tried to execute the stored procedure with "HExecuteProcedure" in the android application that I developed and runs well. My application can receive notifications from NotificationDoctor.FIC, but I think this method is not good because if the mobile app is closed, the stored procedure will not work. That's why it has to be run directly on HFSQL server.
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 19 avril 2021 - 15:45
Hi Thomas

Maybe just maybe following this link:
https://help.windev.com/…

And the code you provide I suppose it's the store procedure of HFSQL C/S
well on that code you follow everything PCSoft says but I don't see nothing of executing the stored procedure of the data base.
I'm not familiar with this schedule task thing but maybe the notification it's not running because on the procedure of the schedule task never call the procedure of the notification

Not sure about this but you could try and see if it works.

The code you post talk about to access the .fic on your DB and save data on that table but never runs the procedure containing the notification
I'm guessing rigth here if you have a stored procedure for the notification

Also if this procedure have any other access to another table instead of NotificationDoctor make sure to use HDeclareExternal.

Hope I could guide you to the right direction.

And if it works make sure to post it to make everyone knows the solution and also for me

Also when you have the answer what version of Windev Mobile are you using?
And what type of code do you use to send the notification?

I use on the past HSendNotif but it's stop working because Android and iOS change a lot the code for the notification from Windev23 (version that I'm using) so I need to update to be able to use this notification methods
If you use code from Android or in iOS use Xcode code this could be helpful too.

Good luck!

--
Best Regards
ARV