Community forum

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-10-29T15:02:03Z
Hello,

Is there more sample source code available
fe. : to add a job with conditions.

thanks
Sponsor
Forum information
Support
2010-11-02T11:01:37Z
Could you give us more details on what kind of Condition you would like to add and with what settings?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
ralph
  •  ralph
  • No customer Topic Starter
2010-11-02T11:11:26Z
Hello,

objConditionClass.Active = true;
objConditionClass.Description = "Check process ID --> 3";

// sProcessStatus = variable we created which belongs to a job.
objConditionClass.CVariable.Value1 = sProcessStatus; objConditionClass.CVariable.ValueType = TypeCode.Int32;
objConditionClass.CVariable.Value2 = "3";
objConditionClass.SetId = "Cond";
objConditionClass.ConditionType = ConditionClass.ConditionT.Variable;

Also how do I set a variable value using the API?

With regards


Support
2010-11-02T20:08:47Z
Here is an example. One problem might be that you try to set the id yourself (which is auto generated).

            if (s != null)
            {
                if (s.Connected)
                {


                    ConditionSetClass csc = new ConditionSetClass();
                    csc.Description = "Variable Condition set";

                    ConditionClass cc = new ConditionClass();
                    cc.Description = "Variable Condition";
                    // set type of Condition
                    cc.ConditionType = ConditionClass.ConditionT.Variable;
                    cc.CVariable.ConditionCheckType = ConditionClass.ConditionCheckT.Equal;
                    cc.CVariable.ValueType = TypeCode.Int32;
                    cc.CVariable.Value1 = "1";
                    cc.CVariable.Value2 = "2";

                    // add Condition to Condition Set
                    csc.Conditions.Add(cc);

                    // add Condition set
                    s.Conditions.Add(csc);


                    JobClass j = new JobClass();
                    j.Name = "Condition Test Job";
                    // add the Condition Set to the Job
                    j.Conditions.Add(csc.Id);
                    j = s.Jobs.Add(j);

                }
            }

Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
ralph
  •  ralph
  • No customer Topic Starter
2010-11-03T09:46:05Z
Hello,

Thanks for the sample code. It worked perfect !!.

Another question : how do you set a variable value using the API?

Thanks again

Ralph
Scroll to Top