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


dkocur
2013-11-13T22:01:32Z
It would be really helpful if there were an inline "if" function in the Variables section. Something along the lines of {LOGIC(If|{USERVAR(ProdOrQA)}==Production|This is a production server|This is a QA server)} Of course, I would expect all the basic comparisons to be supported, == != < > <= >=. I'll leave the syntax up to you, but another possiblity would be {LOGIC(Equals|{USERVAR(ProdOrQA)}|Production|This is a production server|This is a QA server)}

As you can see from my example, it would allow me to configure a job so that it could easily be moved from one environment to another without having to make parameter changes. I'm sure it would have plenty of other uses as well, such as changing the way a task behaves on a particular day of the week, or based on the results of a previous task. The possiblities are endless.

Thanks!
Sponsor
Forum information
ErikC
2013-11-14T07:10:48Z
Hi dkocur,

At this moment it can be done by the use of conditions. In here you can check variables. You end up with a few more tasks.

I find however it a good idea to enlarge the functions with these ones.
{LOGIC(IF|test|true|false)}


Regards
Erik
Uses Visualcron since 2006.
dkocur
2013-11-14T17:22:18Z
Thanks Erik,

You're right. My goal can be accomplished using conditions. My preference would be an IF function, as it would be cleaner. And, I think it'd be a good addition to VisualCron as it would take Variables to a whole new level of capability.
osirisja
2013-11-15T09:25:33Z
Hi dkocur

I completely agree with your request. I find the existing CONDITIONS functionality very confusing and difficult to manage, particularly in a growing VC environment like ours, so I tend to steer clear of them as much as possible.

As I recall we did previously discuss the possibility of some kind of task structure similar to traditional SELECT/CASE statements, but for now a very simple 'IF' task to call another job or task or set a variable, with perhaps an 'ELSE' option would be a hugely beneficial and logical feature.

Cheers

Andy

Support
2013-11-15T09:34:53Z
So, what do you think of the following implementations below. I have added type so we can do a better comparison and separated the operator as own argument.

Comparing by string
{LOGIC(If|String|{USERVAR(ProdOrQA}|==|Production|This is a production server|This is a QA server)}

Comparing by integer
{LOGIC(If|Integer|{USERVAR(MyNumber}|==|2|My number is matching|My number is not matching)}


Comparing by integer and other operators
{LOGIC(If|Integer|{USERVAR(MyNumber}|>=|2|My number is matching|My number is not matching)}
{LOGIC(If|Integer|{USERVAR(MyNumber}|!=|2|My number is matching|My number is not matching)}
{LOGIC(If|Integer|{USERVAR(MyNumber}|<|2|My number is matching|My number is not matching)}

Comparing other types
{LOGIC(If|Boolean|{USERVAR(MyBool}|==|False|My number is matching|My number is not matching)}
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Support
2013-11-15T09:37:22Z
Originally Posted by: osirisja 

Hi dkocur

I completely agree with your request. I find the existing CONDITIONS functionality very confusing and difficult to manage, particularly in a growing VC environment like ours, so I tend to steer clear of them as much as possible.

As I recall we did previously discuss the possibility of some kind of task structure similar to traditional SELECT/CASE statements, but for now a very simple 'IF' task to call another job or task or set a variable, with perhaps an 'ELSE' option would be a hugely beneficial and logical feature.

Cheers

Andy



Have you looked at the new "Flow"? This is the new way to control which Task should be run next. And you can do a Variable comparision before this.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
ErikC
2013-11-15T09:44:14Z
Support wrote:


Comparing by integer and other operators
{LOGIC(If|Integer|{USERVAR(MyNumber}|>=|2|My number is matching|My number is not matching)}
{LOGIC(If|Integer|{USERVAR(MyNumber}|!=|2|My number is matching|My number is not matching)}
{LOGIC(If|Integer|{USERVAR(MyNumber}|<|My number is matching|My number is not matching)}


The last line misses a comparison number I think ;-)

But yes, this is a nice addition and will enrich the variable functionality.

Regards,
Erik


Uses Visualcron since 2006.
Support
2013-11-15T09:52:43Z
Originally Posted by: ErikC 

Support wrote:


Comparing by integer and other operators
{LOGIC(If|Integer|{USERVAR(MyNumber}|>=|2|My number is matching|My number is not matching)}
{LOGIC(If|Integer|{USERVAR(MyNumber}|!=|2|My number is matching|My number is not matching)}
{LOGIC(If|Integer|{USERVAR(MyNumber}|<|My number is matching|My number is not matching)}


The last line misses a comparison number I think ;-)

But yes, this is a nice addition and will enrich the variable functionality.

Regards,
Erik



Thanks, updating post.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
osirisja
2013-11-15T10:55:17Z
Hi Henrik

I have seen FLOW and I do use it - mostly for Notifications, but from a Visual, self documenting and structure perspective an 'IF' task would be a nice task to have, even if it is just calling the FLOW dialogue? That said, I can't see in the FLOW how to achieve the following:

1. Set a Variable to a particular value
2. Have the option to Run a TASK or a JOB on this or any other VC Server, and then return and continue from this point

Perhaps I am either missing something?

Cheers

Andy

Support
2013-11-15T11:15:06Z
Originally Posted by: osirisja 

Hi Henrik

I have seen FLOW and I do use it - mostly for Notifications, but from a Visual, self documenting and structure perspective an 'IF' task would be a nice task to have, even if it is just calling the FLOW dialogue? That said, I can't see in the FLOW how to achieve the following:

1. Set a Variable to a particular value
2. Have the option to Run a TASK or a JOB on this or any other VC Server, and then return and continue from this point

Perhaps I am either missing something?

Cheers

Andy



Perhaps I am misunderstanding you but to achieve that you first use Set Variable Task and then in a new Flow you do the Variable comparison and based on that run a Task or Job.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
osirisja
2013-11-15T14:12:12Z
Hi Henrik

What happens when the run Job or Task completes? Does it return to the Point where the FLOW was called? In real terms, such as in a Condition, this is generally what would happen?

Cheers

Andy
Support
2013-11-15T15:17:30Z
Originally Posted by: osirisja 

Hi Henrik

What happens when the run Job or Task completes? Does it return to the Point where the FLOW was called? In real terms, such as in a Condition, this is generally what would happen?

Cheers

Andy



What should happen is that Flow can have any number of events. So, for example if you have 2 on success events it should process both. Currently in no particular order.

I noticed one thing though. If you have On success - Continue to next Task and On success - Run Job it does not finish current Job but jumps directly to other Task. Not sure if this was intended or a bug. Needs to investigate this.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
dkocur
2013-11-15T15:42:21Z
Originally Posted by: Support 

So, what do you think of the following implementations below. I have added type so we can do a better comparison and separated the operator as own argument.

Comparing by string
{LOGIC(If|String|{USERVAR(ProdOrQA}|==|Production|This is a production server|This is a QA server)}

Comparing by integer
{LOGIC(If|Integer|{USERVAR(MyNumber}|==|2|My number is matching|My number is not matching)}


Comparing by integer and other operators
{LOGIC(If|Integer|{USERVAR(MyNumber}|>=|2|My number is matching|My number is not matching)}
{LOGIC(If|Integer|{USERVAR(MyNumber}|!=|2|My number is matching|My number is not matching)}
{LOGIC(If|Integer|{USERVAR(MyNumber}|<|2|My number is matching|My number is not matching)}

Comparing other types
{LOGIC(If|Boolean|{USERVAR(MyBool}|==|False|My number is matching|My number is not matching)}



Hi Henrik, that works for me!
osirisja
2013-11-15T15:50:20Z
Hi Henrik

From my perspective I am thinking about the FLOW (or an 'IF' condition) as being a functional part of a programs flow (in this case, a VC JOB) - a temporary logic diversion, if you like. No matter what the outcome of the 'IF' statement, processing always returns to the mean and continues with the normal flow of the application.

If the FLOW function simply stops where it currently is and moves on to another Job or Task, our more complicated jobs would end up as spaghetti with the 'FLOW' task only making sense as the last Task in a Job?

BTW - I am not a programmer so forgive my rather simplistic view of the above :-)

Cheers

Andy
grendel70
2013-11-15T21:05:00Z
Following along what I think Andy is after, suppose I want to have something like:

Run Task A to get result
If A.result = X, then do Task B else do Task C
Do Task D (always)

If I understand flows correctly, I would first create these Tasks:
Task A - query
Task B - conditional action
Task C - conditional action
Task D - unconditional action

In Task A, I'd have a Flow test that forces control to Task B or Task C. The question is what happens after B/C end and what additional flow configuration is necessary to get to Task D (and avoid things like flowing from B into C).

If I understand flows correctly, we need:

Task A - OnSuccess - If X, go to Task B
Task A - OnSuccess - If not X, go to Task C
Task B - OnSuccess - go to Task D

There's no need for an OnComplete within Task A since control won't come back to it once forced to Task B/C. Similarly, nothing is needed on Task C since flow with naturally head to Task D with the default OnSuccess - go to next Task.

Now the extra credit, how does this work within a loop?

Task A - get List of keys
Loop - for each key
Task B - perform query using key
Task C - action to be performed only if key satisfies some condition in B (eg., there are records for the key)
end Loop
Task D

How do I initiate the next iteration of the loop, avoiding Task C, when the condition is not satisfied?

The initial flow control in Task B seems simple (OnSuccess - rowcount > 0, go to Task C). And I don't think anything special is needed within Task C. But how do I skip Task C and initiate the next iteration when rowcount is 0 in Task B? I don't want to pass control directly to Task D since that exits the loop. And I'm afraid to explicitly pass control back to Task B since I'm guessing that won't be treated as a new loop iteration.
Support
2013-11-29T08:54:14Z
We have now added the LOGIC Variables to this version:

http://www.visualcron.co....aspx?g=posts&t=3543 
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top