Creating a list in ECA that can be used as an argument to a view

Created on 19 May 2023, over 1 year ago
Updated 3 August 2023, over 1 year ago

Problem/Motivation

I have a simple taxonomy view which takes a multi-value term TID argument like this...

In order to test this, I used a list of TIDs like this...

This all works perfectly, I have no doubt that the simple view works.

Inside ECA I wish to execute the view using an ECA Execute view action and send to it a dynamically generated list of TIDs, just like my test list above...

I am definitely referring to the correct view, and I am attempting to send to it a custom ECA list [tids_list] which I have created that contains a list of TIDs.

I created that [tids_list] token by iterating another token which I created earlier [syllabus_terms_list] which in an ECA Drupal message action, looks like this...

I first created the [tids_list] by appending [syllabus_term:tid] as I iterated the big fat terms list [syllabus_terms_list], which when doing a ECA Drupal message action debug, looked like this...

But the Execute view action simply returned an unpopulated [i_statements_list] token, which tells me that the view is returning an empty list.

So I then tried to get hold of just the TIDs by populating the [tids_list] using [syllabus_term:tid:value]. The debug gave me this...

But the Execute view action still doesn't return anything other than an unpopulated [i_statements_list] token.

Summary

In summary, after this lengthy illustration, I am really wanting to know how I should iterate a taxonomy terms list that I've built using ECA and send the list of TIDs as a Contextual argument to a view?

I've been at it for hours and I'm going bonkers trying to figure out this key-value pair thing. Sometimes there's one dash, others there's two; is what I'm seeing in the debug actually what is being sent to the view or is it just an ECA/Drupal message representation? I'm at a loss.

Thank you for any help!

πŸ’¬ Support request
Status

Fixed

Version

1.1

Component

Miscellaneous

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @missclickalot
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Your token tids_list contains a complex object with a list of data items. But the argument forwarded to the view needs to be a string. That said, you want to find a way on how to turn your list into a string that contains just the tids, separated by commas.

    You can either use a loop, for which you can find some examples in the ECA Guide library. Or, you may want to give the eca_tamper module a try, which provides you with an implode action which turns a list into a string with a given separator. Please verify you use the latest dev release for that, since we've fixed that action recently in πŸ› Implode does not work for arrays Fixed to work with more list types.

  • Thank you @jurgenhaas β†’ for replying to me with this information, I appreciate the help.

    I'll give it a go.

  • Status changed to Postponed: needs info over 1 year ago
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen
  • πŸ‡ΊπŸ‡ΈUnited States trenttati

    Thank you @jurgenhaas for recommending eca_tamper as a potential solution. I had a similar problem to solve and Tamper's implode worked perfectly within my model.

    The Tamper: Impode event I set up looked like this:

    eca_data: '[node:field_multi_term_ref]'
    eca_token_name: shared_tids
    glue: ','

    And the output is a list of TIDs separated by commas. Providing the "shared_tids" token I created via the event to the Query View event in the Arguments field results in the view receiving the expected list of taxonomy term TIDs as contextual filters.

  • Status changed to Fixed over 1 year ago
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024