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

Conditional member tags #21

Open
nmazidi opened this issue Aug 9, 2021 · 4 comments
Open

Conditional member tags #21

nmazidi opened this issue Aug 9, 2021 · 4 comments
Labels
enhancement New feature or request needs author feedback Pending additional information from the author needs investigation Investigation needed to find more information, e.g. is this a bug, is the feature viable.

Comments

@nmazidi
Copy link

nmazidi commented Aug 9, 2021

Is is possible to use conditional member tags with this extension? I would like to be able to subscribe a user to a tag if a boolean value is true.

Thanks

@barticus barticus added enhancement New feature or request needs investigation Investigation needed to find more information, e.g. is this a bug, is the feature viable. labels May 17, 2022
@barticus
Copy link
Collaborator

We'll have a look at how this can be done!

Is the request to have something like this:

{
  "conditionalTags": {
    "MY_TAG_VALUE": "field1"
 }
}

which would result in the tag MY_TAG_VALUE being added if field1 is "truthy", or would it be like this:

{
  "memberTagsV2": [{
    "field": "field1",
    "conditionField": "field2"
 }]
}

which would add a tag of the value of field1 if field2 is "truthy"?

@barticus barticus added the needs author feedback Pending additional information from the author label May 17, 2022
@Zer0cool360
Copy link

I'm right now trying to figure out a creative way to do this with jmes, is there a better way? I have a field that has either null or a date and I want to give users a tag if it isnt null, but don't want to make the tag the actual date string lol.
Thank you for your help

@barticus
Copy link
Collaborator

barticus commented Feb 6, 2023

@Zer0cool360 the best I can think of is re-mapping the "entries" into an array first, and then filtering out the null "values", and returning the keys. Example here: http://play.jmespath.org/?u=ab0390a9-e58b-4e03-a4fc-9d3d460a72bd

Given a body like

{
  "field1": "2020-02-01T01:01:01Z",
  "field2": null
}

A query like this will work:

[{ "key": 'field1', "value": @.field1 }, { "key": 'field2', "value": @.field2 }] | [?value!=null].key

But I understand this is a bit ugly!

@Zer0cool360
Copy link

Perfect, Thank you @barticus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs author feedback Pending additional information from the author needs investigation Investigation needed to find more information, e.g. is this a bug, is the feature viable.
Projects
None yet
Development

No branches or pull requests

3 participants