Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feeding the Conditional resolver true/false results without using parameters #41

Closed
dieeisenefaust opened this issue Mar 24, 2023 · 4 comments

Comments

@dieeisenefaust
Copy link

From the examples I have looked over and the testing I have run, it does not appear that trueResult/FalseResult parameters can be set to a hardcoded line of text, but have to be fed their values from an entry in the parameter object.

If you have a flow spec with multiple conditionals which each have different true/false results, it would be easier to be able to write those directly in the params instead of having to feed in multiple different key/value pairs in hte parameters object.

Ex.

          resolver: {
            name: 'flowed::Conditional',
            params: { condition: 'intervalsCreated', trueResult: 'This is the text for true' , falseResult: 'This is the text for false' },
            results: {onTrue: 'ontrue', onFalse: 'onfalse'},
          },

And/or also being able to reference values in the context object

Ex.

        resolver: {
          name: 'flowed::Conditional',
          params: { condition: 'intervalsCreated', trueResult: 'context.context_true' , falseResult: 'context.context_false' },
          results: {onTrue: 'ontrue', onFalse: 'onfalse'},
        },
@danielduarte
Copy link
Owner

Hi @dieeisenefaust,
You can set hardcoded values by using an object with the property val , just like in this example:

      resolver: {
        name: 'flowed::Conditional',
        params: {
          condition: 'intervalsCreated',
          trueResult: { val: 'This is the text for true' },
          falseResult: { val: 'This is the text for false' }
        },
        results: {onTrue: 'ontrue', onFalse: 'onfalse'},
      },

That way Flowed knows it has to be taken as a literal value.
Using a string, it is taken as a "token" to be taken from the requires clause.

@dieeisenefaust
Copy link
Author

Awesome! I figured you had it covered but couldn't find it in the documentation.

If you are okay with me pinging you with some more questions down the line and start a wiki page for the project, I would be happy to help add to the documentation from the standpoint of a user without knowledge of the core code.

@dieeisenefaust
Copy link
Author

Should have tested this before responding but just a note that the property name needs to be value, not val, in the example above.

@danielduarte
Copy link
Owner

Yeah, you're right, it is value actually, thanks for correcting me!
I'm OK with you pinging me with questions, and glad to know about the missing doc from the user's perspective.
Also, I know I owe more doc to the community.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants