1

My need is to combine fields which their data type is integer.

I did not find a module for that. Or is there? The "Global: Combined fields" filter supports strings only.

Which approach would you recommend to achieve this? Thanks!

[Edit]

After seeing a comment from @scronide I am adding here some info (this is more generic so I do not comment his comment).

One might indeed choose the direction of saving a value in another field. It may be indeed as a computed field, but also as another integer field which - in its turn - holds the wanted value using code or rules.

However, I wanted to consider the on-the-fly retrieving the items.

Still, may be the separate field direction is better to go with. I will give here my exact situation, also as @Roy Segall suggested.

GIVEN - Using Search API indexes for the view's exposed filter; - Multiple integer field in a few content types. In the "Person" content type I have: "Year born", "Was active from", "Was a king from", etc. In another content type "Work" I have "Year written", "Year published", etc.

NEED - The exposed filter is in a view where both content types are located and should return results of any item of any content type which holds a value bigger than or equal to the search value in any of the integer fields.

NOTE As I am not an expert regarding performance, I am not sure which direction is the way to go; that is, saving a separated field (shared one across types) and index it for a simple filtering, or rather indeed filter on the fly among multiple fields.

Thanks for using your calories in your brain to help me think... Amir

0

Add a Computed Field to the content type to calculate the sum of the other fields–stored as an integer–and then you can use it as a Views filter. You will need to re-save your nodes to generate the computed field values.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.