Switchcase Operation

Switchcase Operation

An operation which exposes an indefinite amount of responses, just like the Manual operation already available in the Base content pack from Micro Focus, but this operation would not take manual user input instead it would have an input which is filled from a flow variable or such.

By having this operation you could define multiple flowpaths within the flow. During runtime it would be determined which path will be taking. This could also be achieved by chaining String Equals comparators after each other, but this solution would make the flow unnecessarily complex and as such decrease maintainability and performance.

For more information on switchcase operation please read the wiki page:
https://en.wikipedia.org/wiki/Switch_statement

Tags (1)
9 Comments
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

It is solved by Operation with multiple responses and Scriptlet that sets needed response.

Sample code:

var types = ["shell", "sql", "xml"];

if (typeof type != 'undefined') {
    if (types.indexOf(type)>=0) {
        scriptletResponse = type;
    } else {
        scriptletResponse = "shell";
    }
} else {
    scriptletResponse = "shell";
}

StaticVoid Super Contributor.
Super Contributor.

oleg.sukharev@h

Thank you for reacting to the request, but this was not really what I was trying to accomplish. I've already created this kind of setup and while it may work, it only works in that specific setting/context. Putting it another way if I needed more than 6 transitions it would already become tedious to create another operation with exaclty the needed amount of responses. In the end you would end up with something akin to a content pack consisting of operations like "Do nothing with three responses", ""Do nothing with 4 responses et cetera. Seeing that MicroFocus already has some of the groundwork already down in the "Manual"-operation found in the Base content pack, I would rather like to see something like it in functionality and usability, but without the user interaction that the "Manual" operation requires.

AndreiTruta Outstanding Contributor.
Outstanding Contributor.
Status changed to: Waiting for Votes
 
AndreiTruta Outstanding Contributor.
Outstanding Contributor.

CloudSlang introduced a while ago the concept of decisions.

One can create decisions with multiple results based on a "case" like input. Decisions committed to GIT can be consumed in OO Work Flow Designer.

In the future we are thinking to enable Decisions addition directly in Designer.

with the 2018.12 release we have introduction the New Python Creation in OO Designer. A simple python operation can be created to mimmic a switch like implementation too

Similar to the below, even though using decisions would make more sense here.

namespace: oo-demo.utils
operation:
name: switch_as_operation
inputs:
- case
python_action:
script: pass
results:
- A: "${case=='a'}"
- B: "${case=='b'}"
- DEFAULT

Creating the above is easy and does not require writing the script but simply adding new results in the designer UI.

We are envisioning to give similar ability for decision in the future.

You might end up creating multiple switch like decisions indeed depending on your cases.

Screenshot_32.png 

Micro Focus Expert
Micro Focus Expert

@AndreiTruta , @StaticVoid  this is a request for AFL content or for CloudSlang? @StaticVoid  if this feature is provided for CloudSlang will it work for you?

@StaticVoid  from your description looks like you want to be able to add custom responses at step level. This means once you add a step in a flow to be able to define responses dinamically like in Manual case operation?  

Thanks,

Lucian

StaticVoid Super Contributor.
Super Contributor.

@Lucian-Revnic I know it's not for CloudSlang as such the solution for CloudSlang doesn't work for me, and I don't know the term AFL. Your second line is right on the money though.

Thanks,

StaticVoid 

Micro Focus Expert
Micro Focus Expert

Thank you @StaticVoid 

AFL comes from Advanced Flow Language and it's the legacy OO flow language.  You can loke at AFL as the XML format that is used by the Desktop Studio when authoring flows.

CloudSlang  (YAML based) is used as native flow language in Web Designer. It is human and dev friendly as it allows diffs between flows and integration with dev friendly IDEs like IntelliJ (https://docs.microfocus.com/itom/Operations_Orchestration:10.81/Use/Using_OO_Central/Slang  )

StaticVoid Super Contributor.
Super Contributor.

Thank you @Lucian-Revnic for your explenation.

Then I meant this idea to be applicable to AFL in the first place, but I would think it wise for MF to also think of making it available in their other supported languages, if it isn't so already. 

Micro Focus Contributor
Micro Focus Contributor
Status changed to: Under Consideration

The idea received enough support from the community to be considered for prioritization in our future development planing.

We will continue to monitor the idea so please expect further updates.

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.