Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to set part of the field as dimension

I have a table with one field with the value as

fruit - apple

fruit - banana

vege - cabbage

vege - carrot

how can i set the dimension only fruit and vege, which is the first part before the sign '-'?

1 Solution

Accepted Solutions
stigchel
Partner - Master
Partner - Master

You can use

=Subfield(Label,' - ',1)

in both script and front end, but it would be better to use it in the script

View solution in original post

8 Replies
neelamsaroha157
Specialist II
Specialist II

You can create a dimension in your script as

Left(FieldName, Trim(Index(FieldName, ' ',1))) as FriutType

and then use that in front end.

vishsaggi
Champion III
Champion III

May be try this:

LOAD SubField(Dim1, '-', 1) AS Dim2;

LOAD * INLINE [

Dim1

fruit - apple

fruit - banana

vege - cabbage

vege - carrot

];

stigchel
Partner - Master
Partner - Master

You can use

=Subfield(Label,' - ',1)

in both script and front end, but it would be better to use it in the script

sunny_talwar

You can read more about SubField here:

The Secret Life of SubField‌ and

SubField ‒ QlikView

Anonymous
Not applicable
Author

Thanks a lot!

Anonymous
Not applicable
Author

Thank you very much.

Anonymous
Not applicable
Author

Really appreciate! i used it in calculated dimension and it works!

Anonymous
Not applicable
Author

nice! thank you!