Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Robertom
2015-10-22T16:29:48Z
Hi,
I'm trying to add a task to a job whit this code


....
        Dim Job = New VisualCron.JobClass
        Job.Name = "Job name"
        Job.Group = "Group"
        Job.Description = "Description"

        Dim task As VisualCron.TaskClass
        task = Job.AddTask(VisualCron.TaskClass.TaskT.VariableSet)
        task.Name = "TaskName"
        task.VariableSet.UserVariable.Name = "VarName"
        task.VariableSet.UserVariable.Description = "VarDESC"
        task.VariableSet.UserVariable.ObjectType = TypeCode.String
        🅱task.VariableSet.UserVariable.ValueObject = ?????[/b]

....


How i change the valueObject?
I see the new job in visualcron but i can't modify the value of the userVariable.

Thanx
Sponsor
Forum information
Support
2015-10-22T18:27:09Z
If you use serverObj.Jobs.JobVariables.AddUpdate() - you just specify key and value.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Support
2015-10-22T18:27:56Z
Or you can use jv.ValueObject = serverObj.Encrypt()
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Robertom
2015-10-23T07:38:04Z
Originally Posted by: Support 

Or you can use jv.ValueObject = serverObj.Encrypt()



This is what i need, but i can't find it.
What class contains the method "Encrypt"?
Support
2015-10-23T07:43:37Z
My mistake, the encrypt method is in the Client class. clientObj.Encrypt(). It has been added to Server class as well for next build.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Robertom
2015-10-26T17:32:37Z
NOPE!

I create the job with this code:

....
        Dim Job = New VisualCron.JobClass
        Job.Name = "Job name"
        Job.Group = "Group"
        Job.Description = "Description"

        Dim task As VisualCron.TaskClass
        task = Job.AddTask(VisualCron.TaskClass.TaskT.VariableSet)
        task.Name = "TaskName"
        task.VariableSet.UserVariable.Name = "VarName"
        task.VariableSet.UserVariable.Description = "VarDESC"
        task.VariableSet.UserVariable.ObjectType = TypeCode.String
        task.VariableSet.UserVariable.ValueObject =  ClientObj.Encrypt("TEST")

....


I see the job in visual cron correctly, but Running the job/task i get this error:
Quote:


Unhandled error in SetVariable: System.InvalidOperationException: Errore nel documento XML (1, 1). ---> System.Xml.XmlException: Rilevati dati non validi al livello radice. Riga 1, posizione 1.
in System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
in System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
in System.Xml.XmlTextReaderImpl.ParseDocumentContent()
in System.Xml.XmlReader.MoveToContent()
in System.Xml.Serialization.XmlSerializationPrimitiveReader.Read_string()
in System.Xml.Serialization.XmlSerializer.DeserializePrimitive(XmlReader xmlReader, XmlDeserializationEvents events)
in System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
--- Fine della traccia dello stack dell'eccezione interna ---
in System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
in OBOKIIHBDBPMCFALPGECCIFHCDJPEDKODDGK.MGLNHPPKDCCKDPNBCENHDMEIPAGBOLKEHNGM.OLDBBAHMBPBAIBLDHMIAPKPIOLBIJBKLKJHD.HOJMMAIEMGIHFJDPBILPDGDDIAKLLLFFJFKA(String , Type , Boolean ) in C:\sourcefiles\code\VisualCronService\Main\modXML.vb:riga 129
in VisualCronService.VariablesAPI.GetVariableValue(Byte[] ValueObject, TypeCode ObjectType, VariableReplacerClass VR) in C:\sourcefiles\code\VisualCronService\Variables\apiVariables.vb:riga 259
in VisualCronService.VariablesAPI.GetVariableValue(UserVariableClass uv, VariableReplacerClass VR) in C:\sourcefiles\code\VisualCronService\Variables\apiVariables.vb:riga 244
in OBOKIIHBDBPMCFALPGECCIFHCDJPEDKODDGK.MBMHNJEFPGOMLCDMANINOFKHALKKLMPEFBJA.IDFIKEDJHGPCEDDEDCLJBKGCEIMGBDHAKLHH() in C:\sourcefiles\code\VisualCronService\Jobs\TaskProcesses\Internal\clsProcessTaskVariableSet.vb:riga 55



Support
2015-10-26T17:45:06Z
Sorry, please use the:


        task.VariableSet.UserVariable.ValueObject =  ClientObj.Encrypt(SerializationHelper.XmlSerialize("TEST"))

Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Robertom
2015-10-27T09:39:28Z
ClientObj.Encrypt(SerializationHelper.XmlSerialize("TEST")) don't compile.

I have try
SerializationHelper.XmlSerialize(ClientObj.Encrypt("TEST"))
Or
SerializationHelper.XmlSerialize("TEST")

Same error.
Support
2015-10-27T10:04:59Z
To prevent misunderstanding we made this simplier by creating a method for this:

serverObj.Variables.SetVariableValue(TypeCode, value)

You need to upgrade to this version:

http://www.visualcron.co....aspx?g=posts&t=5231 
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Robertom
2015-10-27T11:05:06Z
Originally Posted by: Support 

To prevent misunderstanding we made this simplier by creating a method for this:

serverObj.Variables.SetVariableValue(TypeCode, value)

You need to upgrade to this version:

http://www.visualcron.co....aspx?g=posts&t=5231 



I don't undestand.
I need to add a TASK that set the value of the user variable.
Where i use serverObj.Variables.SetVariableValue(TypeCode, value)?
Support
2015-10-27T13:24:07Z
1. you need the new version installed to simplify this. You find the new version here: http://www.visualcron.co....aspx?g=posts&t=5231 
2. you set uv.ValueObject = serverObj.Variables.SetVariableValue(TypeCode, value)
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Users browsing this topic
Scroll to Top