Developer forum

Forum » Feature requests » Expression Group based on Boolean parameter

Expression Group based on Boolean parameter

Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi,

 

I have a problem and no great solution, despite the name I provided.

 

A customer asked us for a boolean "filter"(facet) to only show products that they have previously purchased in the last X months:

  • Creating the Macro was simple
  • Setting up an expression to only return Product associated with the Macro is also simple
  • Only trigger the expression if a certain querystring parameter is set to 'true' - not so simple

 

The problem is that we need to associate non-product data to determine which expressions to load. Maybe by having a condition on the Expression group we could trigger large groups of expressions to be triggered.

 

Best Regards,

Nuno Aguiar


Replies

 
Nicolai Pedersen
Reply

Or let the macro return null if the querystring parameter is not present...?

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Nicolai,

 

Re-reading my thread, there's something I can be more specific about. The name of the facet is for example (a checkbox) "Only show previously ordered items" (there's some extra and additional logic that the Macro handles - for simplicity purposes I will keep out of it).

 

  • If I understand you correctly, we'd have to hardcode the querystring parameter within the macro - which is doable for my particular project
  • What I was requesting is a dynamic way where we could use existing repository functionality in the expressions (Terms, Macros, Code,...) but having those be triggered based on boolean that we could set in the repository (not in an assembly).

 

Best Regards,

Nuno Aguiar

 
Nicolai Pedersen
Reply

Then you can use a code expression editor. It is a configurable add-in and you can have a parameter so you can configure what querystring parameter you want to look for.

BR Nicolai

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Nicolai,

 

Gotcha. That sounds like it will work then. Thanks.

 

Nuno Aguiar