Runing a task outside of robotask

Discuss RoboTask here
Post Reply
eranz
Posts: 1
Joined: Tue Jul 27, 2021 8:34 am

Runing a task outside of robotask

Post by eranz »

Hello,
I have a table of items in sql server.
I want to give the ability for a user to delete an entry (an item) from the table.
I can create a task that runs a sql query to delete the requested item from the table.
How can I give the ability for the user to run this task without opening the robotask and edit the item id in the sql query.
Can I create some kind of gui?
Or can he send a mail to some email address with the subject 81 for example, the task will monitor this mail once an hour, take this parameter and delete item 81 from the items table?

Thanks,
Eran
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Runing a task outside of robotask

Post by Oleg »

You can use parametrized SQL query. You can read necessary values from Input Dialog or from text file (as you wish)

Look at my example below
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1163085779
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task142"
Hide=INTEGER|0
ID=INTEGER|474830898
LogOnAsUser=INTEGER|1
Name=STRING|"delete specified record"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER

[Actions\Action1]
ActionID=STRING|"A_DIALOG_INPUTBOX"
Enabled=INTEGER|-1
Name=STRING|"Input Box"
Params=FOLDER

[Actions\Action1\Params]
default=STRING|"0"
password=STRING|"0"
prompt=STRING|"Enter ID of record to delete"
variable=STRING|"RECORDID"

[Actions\Action2]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action2\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"1"
type=STRING|"1"
value1=STRING|"{RecordID}"
value2=STRING|"0"

[Actions\Action3]
ActionID=STRING|"A_EXECSQL"
Enabled=INTEGER|-1
Name=STRING|"SQL Query"
Params=FOLDER

[Actions\Action3\Params]
assignvar=STRING|"1"
connectionstring=STRING|"Provider=MSDASQL.1;Persist Security Info=False;Data Source=MySQLTest"
override=STRING|"0"
paramcount=STRING|"1"
password=STRING|"2159219849198532138421648"
pname0=STRING|"param1"
ptype0=STRING|"1"
pvalue0=STRING|"{RecordID}"
sql=STRING|"""delete from testtable where id = :param1"""
timeout=STRING|"60"
varname=STRING|"num"

[Actions\Action4]
ActionID=STRING|"A_ROBOTASK_ALERT"
Enabled=INTEGER|-1
Name=STRING|"Show Notification"
Params=FOLDER

[Actions\Action4\Params]
colorscheme=STRING|"0"
defh=STRING|"1"
defw=STRING|"1"
duration=STRING|"5"
height=STRING|"76"
icon=STRING|"3"
kind=STRING|"0"
message=STRING|"{num} records deleted"
position=STRING|"3"
title=STRING|"Delete record "
width=STRING|"330"

[Actions\Action5]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
Oleg Yershov
Post Reply