Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
soha1902
Creator
Creator

TextObject

Hi All,

  I have one field name MyField which contains a value like:


 

MyField


 

 

AB-10,  ABC9-AB-12, BCDE-15,ZEAB-031-71


 

 

Now I want to show this value in Text Object only with
following formatting:

Part1     -              Part2

  AB          -              10

  ABC9     -              12

  BCDE     -              15

  ZEAB      -              71

Please help to find this.

Thanks.

1 Solution

Accepted Solutions
stigchel
Partner - Master
Partner - Master

14 Replies
Clever_Anjos
Employee
Employee

These values AB-10,  ABC9-AB-12, BCDE-15,ZEAB-031-71 are stored in only one record or 4?

soha1902
Creator
Creator
Author

Its only one record.

Should Its easy to got the desired output if these are 4 records? If yes then please let me I'll make it as 4 records and then implement the solution.

Clever_Anjos
Employee
Employee

First you´ll need to split that value at script level

LOAD

  somekey,

  subfield(MyField,',') as MyFieldSplitted

RESIDENT youtable

Then use this expression inside your texbox

concat(MyFieldSplitted,CHR(10))

soha1902
Creator
Creator
Author

I am not getting the correct output. Please find attached qvw.

stigchel
Partner - Master
Partner - Master

Try with something like this in load script

Data:

Load * Inline [MyField

'AB-10,  ABC9-AB-12, BCDE-15,ZEAB-031-71'

];

Load SubField(Lines,'-',1) & '-' & SubField(Lines,'-',SubStringCount(Lines,'-')+1) As NewField;

Load

Trim(SubField(MyField,',')) As Lines

resident Data;

soha1902
Creator
Creator
Author

Its showing only AB-10 in Text Box but I want to show all the values as I mentioned in my original post.

sunny_talwar

Maybe this:

='Part1' & Chr(32) & Chr(32) & Chr(32) & '-' & Chr(32) & Chr(32) & Chr(32) & 'Part2' & Chr(13) &

Concat(SubField(SubField('AB-10,  ABC9-AB-12, BCDE-15,ZEAB-031-71', ',', ValueLoop(1,4,1)), '-', 1) & Chr(32) & Chr(32) & Chr(32) & '-' & Chr(32) & Chr(32) & Chr(32) &

  SubField(SubField('AB-10,  ABC9-AB-12, BCDE-15,ZEAB-031-71', ',', ValueLoop(1,4,1)), '-', -1), Chr(13))



Looks like this in a Text Box:

Output.PNG

stigchel
Partner - Master
Partner - Master

See attached

stigchel
Partner - Master
Partner - Master

Notice the quotation marks around the original string in the inline load in my example that are missing  in your file