Developer forum

Forum » CMS - Standard features » Facets not showing label on checkbox list fields

Facets not showing label on checkbox list fields

Hans Ravnsfjall
Hans Ravnsfjall
Reply

This one is a bit hard to explain,  but here goes.

 

On an item based page, we have a checkboxlist field ( see image below)

 

 

The options in the list, are being fed from a paragraphbased item - where we have configured the paragraphName to be the label (see image below)

 

 

In the index/repository - I have configured this, so that the value is a string[]. But when outputting the facets, it does not show the Label of the checkbox list option, but instead it show the ID of the Item that the option is based on. I have another facet group, that is based on a select box, where the options are a native part of the Item Page. That one works as intendend, with the same loop code for the options for the Facets, so it should not be the template code where the facet options are rendered.

 

What am I doing wrong?

 

/Hans

 


Replies

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply
This post has been marked as an answer

Hi Hans,

 

I don't think you are doing anything wrong.

  • When you are pointing at a select box, that's a known and trustworthy mapping, so it's possible to get label and have the facets look friendly
  • When you are pointing to a SQL instance, the repository engine is not trying to determine the label, so you only get labels

 

Although that would be technically possible, I believe it's also a performance pitfall, as SQL queries could be anything and not scale. I would expect you to have to recreate the logic to get the proper label on those fields either:

 

I would go with the ValueMapper option for the needed fields. That way you have more control over the logic without having to expose too much logic in the templates

 

Best Regards,

Nuno Aguiar

Votes for this answer: 1
 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Thank you for your reply Nuno

Was not aware of the value mapper, and will look into that for future needs 👍

I solved it using the Api ( Dynamicweb.Content.Items.ItemManager.Storage.GetById ) Where I - by knowing the ItemType, and the Item ID - can fetch all the other values from the item.

/Hans
 

 

You must be logged in to post in the forum