Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a dimension MATERIAL ,i need values of that filed in two rows on axis what i mean is
suppose Ammonium chloride is it possible to change it in to Ammonium
chloride(breaking all the labels in to two rows )
please find the attachment
thanks
naveen
u can give a try.
because same i got the issue before. i used below code .its wrks fine
=left(Field, findoneof(Field, ' ', ceil(substringcount(Field, ' ')/2))) & chr(13) & chr(10) & right(Field, len(Field) - findoneof(Field, ' ', ceil(substringcount(Field, ' ')/2)))
May be this:
SubField(MATERIAL, ' ', 1) & Chr(10) & SubField(MATERIAL, ' ', 2)
where should i need to write this because MATERIAL is my dimension
so should i write it in ADD CALCULATED DIMENSION
u can give a try.
because same i got the issue before. i used below code .its wrks fine
=left(Field, findoneof(Field, ' ', ceil(substringcount(Field, ' ')/2))) & chr(13) & chr(10) & right(Field, len(Field) - findoneof(Field, ' ', ceil(substringcount(Field, ' ')/2)))
Yes, instead of using MATERIAL, use the above expression.It is not going to be nice when there are more then 2 words
did u try my Expression?
share ur app?
i have found this query in the community, don't remember the link. Add your table and field name.
SUB SplitString (vField, vTable, vSegLen, vSplitField)
Split_temp:
LOAD *,
trim(mid($(vField), Start, Count-1)) as Split,
RowNo() as SplitId
;
LOAD *,
index( mid($(vField) & ' ', Start+$(vSegLen)), ' ' )+$(vSegLen) as Count
;
LOAD
$(vField),
if($(vField) = Previous($(vField))
,peek('Start')+peek('Count')
,1
)as Start
RESIDENT $(vTable)
WHILE IterNo() <= div(len($(vField)),$(vSegLen))+1
;
LEFT JOIN($(vTable))
LOAD
$(vField),
concat(Split, chr(10), SplitId) as $(vSplitField)
RESIDENT Split_temp
WHERE len(trim(Split)) > 0
GROUP BY Title
;
DROP TABLE Split_temp;
END SUB
MyTable:
LOAD *, RecNo() as RecId INLINE [
Title
This is a long title that spans a long ways
This is a long title that spans a long ways
This one is even very much longer then the previous long title
A shorter title
The rain in Spain
Healthcare / Services / Consulting / Accounting
]
;
// Call parms are Field, Tablename, SplitLength, OutputSplitField
// Split the string in "Field" at the first blank after segment length of "SplitLength".
// New field "OutputSplitField" will be joined to table "Tablename"
CALL SplitString('Title', 'MyTable', 15, 'SplitTitle');
Regards,
Sivaraj