Labels handling for derived fields


#1

Hello everyone y have an application with React and the CF toolkit, I’m using the same label for one of my fields called group_name and for a derived field with the field name group_name_by_section when i apply a filter with this label the filters are not working, i need some support in this point, you know i’m not an expert.


#2

Sounds like you are doing something wrong, to give you a better response, first i need to see your config in the metadata otherwise is hard to understand @mdemian


#3

Sure @emoya is this:

const groupNameByLocation= {
    name: 'group_name',
    label: 'group_name.keyword',
    type: 'ATTRIBUTE',
    dependencies: ['group_section'],
    reverse: (item) => {
        return this.getGroupJsonInfo(item);
    },
    function: (item) => {
        let name = item.[1].groupName;

        return name;
    },
};


"MySource": {
        fields: {
            ...groupNameByLocation,
            group_name: {
                label: 'Group Name',
                type: 'ATTRIBUTE',
            },
        },
    },

#4

@mdemian, the problem could be the label or the field name, if you are using this derived field in just one place and you want to filter by group names you need to specify the same label for both fields(the derived field and the group_name field), and finally if you have another page with and you are using the similar strategy, you can also set a different field name in the derived field in order to use a different label name, otherwise you and the IManager could be confused about how to use properly the filters, you can also see this entry: Derived field filtering, where we are talking about the silimilar situation


#5

Actually yeah, changing the field name in those two pages allowed me to use other labels, thanks for the help. :sunglasses: