Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Incluir caracter '/' no meio de um parágrafo

Olá,

Gostaria de saber se tem como fazer isso:

LOAD * INLINE [

ID, Observação

1, lorem ipsum

2, loremipsum

]

E eu quero que o valor desse meu campo observação fique como:

lo/re/m /ip/su/m

lo/re/mi/ps/um

Ou seja, para cada duas letras, incluir um '/'.

É possível? Pode ser tanto no script quanto no layout.

Obrigada!

1 Solution

Accepted Solutions
maxgro
MVP
MVP

this seems better

1.png

table:

LOAD * INLINE [

ID, Note

1, lorem ipsum

2, loremipsum

3,abcde

];

for r=0 to NoOfRows('table')-1

  let s=Peek('Note', $(r), 'table');

  let id=Peek('ID', $(r), 'table');

  let newnote='';

  for rr=1 to ceil(len('$(s)')/2)

      let newnote='$(newnote)' & mid('$(s)', ($(rr)-1)*2+1, 2) & '/';

NEXT;

  let newnote=left('$(newnote)', len('$(newnote)')-1);

  newtable:

  load '$(id)' as ID, '$(newnote)' as NewNote AutoGenerate 1;

NEXT;

View solution in original post

4 Replies
maxgro
MVP
MVP

RESULT

1.png

SCRIPT

table:

LOAD * INLINE [

ID, Note

1, lorem ipsum

2, loremipsum

];

for r=0 to NoOfRows('table')-1

  let s=Peek('Note', $(r), 'table');

  let id=Peek('ID', $(r), 'table');

  let newnote='';

  for rr=1 to len('$(s)')/2

       let newnote='$(newnote)' & mid('$(s)', ($(rr)-1)*2+1, 2) & '/';

  NEXT;

  newtable:

  load '$(id)' as ID, '$(newnote)' as NewNote AutoGenerate 1;

NEXT;

maxgro
MVP
MVP

this seems better

1.png

table:

LOAD * INLINE [

ID, Note

1, lorem ipsum

2, loremipsum

3,abcde

];

for r=0 to NoOfRows('table')-1

  let s=Peek('Note', $(r), 'table');

  let id=Peek('ID', $(r), 'table');

  let newnote='';

  for rr=1 to ceil(len('$(s)')/2)

      let newnote='$(newnote)' & mid('$(s)', ($(rr)-1)*2+1, 2) & '/';

NEXT;

  let newnote=left('$(newnote)', len('$(newnote)')-1);

  newtable:

  load '$(id)' as ID, '$(newnote)' as NewNote AutoGenerate 1;

NEXT;

Not applicable
Author

Thanks!

Very helpful!!!!

maxgro
MVP
MVP

if you get the answer to your question, please close the thread (mark correct and/or helpful), thanks and good qlik