Search

I have a DS to which I supply a 100,200 filtering value (for system ids) from another DS's output parameter (a text field having the value 100,200).

And it does not work, that is it returns only the first entry match, 100, from the two existing and expected.

If I would directly write 100,200 as the filtering value for the DS, it would work. Or if 100,200 would be an output parameter from a SBL or SSM field. But these I want to bypass.

How can it be done? Please do you have any ideas?

So close to a perfection! I guess..

It sounds like you're using union when you need to use intersection. Have you tried using a plus (+) instead of a comma (,)?

Union

Comma to delimit items in a set of possible matching values joined by OR.

Intersection

Plus signs to delimit items in a set of required matching values joined by AND.

The outputted parameter value for a textbox / textinput is typically the handle, not the value.

100,200 => 100-200

100-200 is actually used.

You'd have to create modify your text field to output the value in param pool, rather than the handle.

What's the matter with SBL? Why are you avoiding it?

@ijy thanks. Yes, I need an union, that is 100 as well as 200 entry. Haven't tried with a + if that would work, can do. Thanks for clarifying too.

@vladG, yes, I was "suspicious" about the handle, but anyway I don't understand why 100-200 still matches an "100" system id.

What's the matter with SBL? Why are you avoiding it?

Actually I use SBL (well, SSM) and I had recently an idea to reduce DB queries for cases where only getting related entries ID for DS output parameters by using Reflection field to store those entries IDs and further using this value. And it does save some queries, at least 20 % and more and speeds noticeably things up. It works with a single value, but not multiple.

You'd have to create modify your text field to output the value in param pool, rather than the handle.

Hah, a daunting task. Based on this idea I was thinking to edit the relevant datasource php file in workspace folder, and there the execute function to find the parameter and set its value into the page param pool, but I dunno how to do that, what to use. It can not be expressed with a single line, can it? Is there an extension which make such things so I can take a look? Or is this a bad approach with the page param pool?

OK, I managed to isolate the value as described, but now to publish it into param pool. I saw it somewhere... hmm

This will never work the way you're trying it as like Vlad says, it's a text field. The text field does however take filtering in the form of a value, a handle, or an ID, so that clears that up a little.

From what I understand, you're trying to have one entry store multiple IDs in a text field, separated by a , and use those values for filtering the IDs of entries in another section?

Will this always be only two numbers, or is there a need for it to scale up like 100,200,300,400 etc etc?

I think you may need to approach this from a data model design perspective rather than try and modify these things.

Can you explain your thinking on why you want to store IDs in a text field? I don't understand why you'd want to hard code dynamic data like that.

From what I understand, you're trying to have one entry store multiple IDs in a text field, separated by a , and use those values for filtering the IDs of entries in another section?

This is correct.

Will this always be only two numbers, or is there a need for it to scale up like 100,200,300,400 etc etc?

There can be more than two, depending on the number of selected related entries.

Can you explain your thinking on why you want to store IDs in a text field? I don't understand why you'd want to hard code dynamic data like that.

I have a section ("Section"), where one of the fields is of type SSM ("Field"), taking multiple entries from a related section. Those entries are related to that Section entry.

Now, a DS, which takes an entry from the Section, outputs the Field as an Output Parameter, to chain-filter other DS's as needed (by system ids). When having it like this, all works well, but there are more DB queries used in the process, namely to construct the "Field" output parameter, probably because it takes entry id's from the related section.

What I try to: I try to have those Field's entry id's ready as a simple field value using the Reflection capabilities to have less of these DB queries.

Hah, crazy no? :) But it saves can say significantly overall page generation time. I use also Conditionalizer and Cacheable datasources extensions too. This is normaly enough, but now I face a web structure of 160+ pages now ("page" = entry in a section) and this sums up when generating menu and general structure I use to generate URLs of, so I try to notch it where I can. I am doing fine so far, but would love to have this one parameter ease on board too.

Another thing is to overhaul the whole structure (but there's no time for that, can be a future update). Also I have heard some time ago of customizing DS's DB queries to join them into one query or so. But this is beyond my reach now. Can be also a future update.

In the mean time, I also managed to get the DS output parameter into the page param pool, but its not recognized for the followed DS chain filter. Maybe it runs after all chaining finishes, but I do create that page parameter in the DS, which outputs that parameter.

Hah, I lack knowledge here.

It is an interesting approach, I often use the reflection field to do similar with page paths.

So, forgive me if I'm wrong, there is a ds output param to filter the reflection field string value?

If so, it's just a matter of filtering with a value of

contains: {$ds-param-name-here}

So, if the ds output has a value of 100 and the field contains 100,200 then it will find 100 and filter the field.

It is an interesting approach, I often use the reflection field to do similar with page paths.

Yes, I wanted to describe it later more, but I run on this issue.

So, if the ds output has a value of 100 and the field contains 100,200 then it will find 100 and filter the field.

The contains: is a cool idea, haven't think of it, but I think I have the opposite situation: the ds output is 100,200 and the field contains 100, or 200 etc. So I would not match.

The ds output collects those XXX entry numbers (system ids) to filter out those related entries later on from the related section.

You'd have to create modify your text field to output the value in param pool, rather than the handle.

Well, I managed to get the DS output value 100,200 into the page param pool (by editing the ds's php file and added it into execute() instructions), but the variable is not recognized in the chained DS, returning so all entries :(

NB: A BIG sorry for my english.

It sounds like you're using union when you need to use intersection. Have you tried using a plus (+) instead of a comma (,)?

@ijy, when I supply a 100+200 for the system id's filter field, it again returns only the 100 entry, which is again strange to me, as I think system id's should take only numbers and if its like that, why it stops at the first one.

OK, if it reaches for the handle, than also 100-200 is not 100, so why the match. Only if it would be a regular match or "starts with", but that would not be accurate.

So there are two points I am curious about:

  1. About the match I mentioned in the sentences above in this comment.
  2. How to create a handle-less value from a ds output parameter on the fly to use it as a filtering value for another DS in chain, so that a 100,200 would be taken like it is, not as a 100-200 value.

Please any ideas? Or is this all wrong what I try to achieve?

The system:id field sanitizes the value by casting it to an integer, so 100-200 is turned into 100.

IMO, it's difficult to achieve what you are after in this way. The value, 100,200 is passed to the datasource as a single value, so it skips all the logic that does AND or OR filtering. For the SBL field, the values are actually passed as an array so that logic can be applied.

If you had to do this, you're best bet would be to hack the field so that implodes the $data on , and then you can make use of the logic.

Thanks a lot brendo, will check on that.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details