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


ralph
  •  ralph
  • No customer Topic Starter
2010-11-03T10:12:49Z
sVarTaskID.ObjectType = TypeCode.UInt32; This works fine except that I can't see the data type because UINT32 is not in list.

When I add a variable using INT32 then I got the following error :

sVarTaskID.ObjectType = TypeCode.Int32;


System.InvalidOperationException: There is an error in XML document (0, 0). ---> System.Xml.XmlException: Root element is missing.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res)
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextReader.Read()
at System.Xml.XmlReader.MoveToContent()
at System.Xml.Serialization.XmlSerializationPrimitiveReader.Read_int()
at System.Xml.Serialization.XmlSerializer.DeserializePrimitive(XmlReader xmlReader, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(Stream stream)
at ODNKNCFDHHPJPCMOFFIIHIOEPAPDAKPENFKF.OLDBBAHMBPBAIBLDHMIAPKPIOLBIJBKLKJHD.HOJMMAIEMGIHFJDPBILPDGDDIAKLLLFFJFKA(String , Type )
at frmAddEditVariable.JCICCEENLMLCNEICAJOJGLLGGMONNFOAHFFJ()
at frmAddEditVariable.MDMDAJJICBBIGOGIFGONOBGAMDKLBLDHAAMC(Object , EventArgs )
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Please I need help!!!

With regards

Ralph
Sponsor
Forum information
Support
2010-11-03T10:20:46Z
Please show the whole code. How did you set the value for example?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
ralph
  •  ralph
  • No customer Topic Starter
2010-11-03T10:29:38Z
Hendrik,

UserVariableClass sVarTaskID = new UserVariableClass();
sVarTaskID.Name = string.Concat(TestJob.Id, "_TaskID");
sVarTaskID.ObjectType = TypeCode.UInt32; <-- Works but type is not visible
//sVarTaskID.ObjectType = TypeCode.Int32; <-- Crashes, same with string
TestServer.Variables.Add(sVarTaskID);


Setting value:
Variables objVariableT = new Variables( TestServer);

objVariableT.SetVariableValue( ref sVarTaskStatus, "3");

Hope this helps

Thanks

Ralph
Support
2010-11-03T10:40:41Z
Currently only three types are allowed:

Int32
String
Double

But you never set the value when adding the Variable? You need to set it before adding.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
ralph
  •  ralph
  • No customer Topic Starter
2010-11-03T10:44:12Z
Hendrik,

How can you do that?

I like this product but what I lack that there are not enough sample code using the API.

Thanks

Ralph

ralph
  •  ralph
  • No customer Topic Starter
2010-11-03T10:48:49Z
Support
2010-11-03T11:05:26Z
I agree and we are working on this. Currently we are adding things in the TestClient upon requests - like this.

When looking further into this I see that it was not so easy doing this in the API as the actual value needs to be encrypted in a special way to keep the information safe. We will improve this for next version. We can probably release a test version for you tonight if that is ok.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
ralph
  •  ralph
  • No customer Topic Starter
2010-11-03T11:13:31Z
Hendrik,

I totally understand this that documentation is not always up to date.
Know that feeling ;-)

A new version would be interesting.

Another question :

can I start a task on a given time :->

The use for this is the following :
I have a job "Payment"
which needs to ask the user on a give time for parameters in our app.

I solved this by adding a Task "Warn User" which creates a messsage in our app using the SQL command.

The actual "payment" task needs to be started 04/11/2010 15.00 and only if the parameters are filled.

I solved the parameter issue by setting a variable in our App using the API when all the parameters are valid.

But how can I set the Custom timer on a specific task? I see this only on a JOB.

I need to thank you for all the info given.

Ralph
ralph
  •  ralph
  • No customer Topic Starter
2010-11-03T11:49:24Z
Question :

How can I set a condition set enabled?

Thanks
Support
2010-11-03T12:08:46Z
ralph wrote:

Hendrik,
Another question :

can I start a task on a given time :->

The use for this is the following :
I have a job "Payment"
which needs to ask the user on a give time for parameters in our app.

I solved this by adding a Task "Warn User" which creates a messsage in our app using the SQL command.

The actual "payment" task needs to be started 04/11/2010 15.00 and only if the parameters are filled.

I solved the parameter issue by setting a variable in our App using the API when all the parameters are valid.




I am not sure what you want to accomplish but you can always run a Task or Job on demand directly through the API but perhaps you want to schedule it any way?

In this case you need to use the custom Time Trigger.

            // create JobClass
            JobClass j = new JobClass();
            // set name of Job
            j.Name = "ExecuteJob 2";
            // add description to Job
            j.Description = "Job with Custom Time Trigger";

            // create custom trigger
            TriggerClass tr = j.AddTrigger(TimeClass.TimeTriggerT.Custom);
            tr.Description = "Run 04/11/2010 15.00";
            tr.TTime.AllYears = false;
            tr.TTime.AllMonths = false;
            tr.TTime.AllDays = false;
            tr.TTime.AllHours = false;
            tr.TTime.AllMinutes = false;
            tr.TTime.Years[0] = 2010;
            tr.TTime.Months[10] = true;
            tr.TTime.Days[3] = true;
            tr.TTime.Hours[15] = true;
            tr.TTime.Minutes[0] = true;
            tr.TTime.Seconds[0] = true;

            // send Job to Server
            s.Jobs.Add(j);

Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Support
2010-11-03T12:09:34Z
ralph wrote:

Question :

How can I set a condition set enabled?

Thanks




You either have it in JobObject.Conditions(Condition set id) or not. Or the same in Task.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Support
2010-11-03T20:11:20Z
It turned out that a new version was not needed. Here is how to add a user variable:

            if (s != null)
            {
                if (s.Connected)
                {
                    UserVariableClass uvc = new UserVariableClass();
                    uvc.Description = "This is my Int32 Variable";
                    uvc.Name = "Int32 Variable";

                    // currently only string, int32 and double is supported
                    uvc.ObjectType = TypeCode.Int32;

                    // this method sets the actual (among other things the value is encrypted here)
                    s.Variables.SetVariableValue(ref uvc, "42");

                    s.Variables.Add(uvc);
                }
            }

Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
ralph
  •  ralph
  • No customer Topic Starter
2010-11-05T11:47:49Z
Henrik,

The following actions are all done using the API.

Question : Iadded a custom time trigger to run on a specific time which succeed.

But when this is finished I like to rerun this task using the same custom trigger but a minute later fe

start trigger fe : 05/11/2010 11:20 run ok

so next run it would be : 05/11/2010 11:21 but when I look it says no next run

This I like to do using the API.

And I don't want to use an interval.

How can I do this using the API?

Ralph

Support
2010-11-05T12:19:29Z
It is hard to say what the problem is. But if "no next run" is visible the trigger has probably been added back in time. Just open the Client and the trigger and you will see if the values you set was correct.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
ralph
  •  ralph
  • No customer Topic Starter
2010-11-05T12:27:00Z
You are correct in this.

When I look the time is not changed.

Here is the code :

VisualCron.JobClass objVCJob = TestServer.Jobs.Get(pJobID);

objJob.CalculateNewTrigger(); // Code which add an interval to the minute

TriggerClass tr = objVCJob.get_Trigger(objJob.TriggerID);

tr.TTime.Years[0] = objJob.WarningYears;
tr.TTime.Months[objJob.WarningMonths] = true;
tr.TTime.Days[objJob.WarningDays] = true;
tr.TTime.Hours[objJob.WarningHours] = true;
tr.TTime.Minutes[objJob.WarningMinutes] = true; // this value is added with 1 minute
tr.TTime.Seconds[objJob.WarningSeconds] = true;

tr.Active = true;

objVCJob.RunOnce = false;
objVCJob.set_Trigger(objJob.TriggerID, tr);
Support
2010-11-05T12:53:34Z
You should not call calculate new Trigger. You need to submit the whole new Job after updating the Trigger.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
ralph
  •  ralph
  • No customer Topic Starter
2010-11-05T13:20:52Z
Henrik,

Do you meaning adding a new job?


Do you sample code for this ?

Ralph
Support
2010-11-06T15:20:04Z
no, use existing job and call:

s.Jobs.Add(your job)
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top