Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
Not applicable

Reverse string character order

Hello,

I would like to know if there any direct function that I can use on a text object to reverse the order of the characters of a string.

For example, I have "Hello World" and I would like to have "dlroW olleH".

Any ideas?

Thank you in advance!

Ivo

2 Replies

Re: Reverse string character order

Temp:

Load

  MyText,

  Concat(Letter,'',-row) as Reversed

Group By MyText;

Load

  MyText,

  IterNo() as row,

  Mid(MyText,IterNo(),1) As Letter

Inline

[

  MyText

  Hello World

  This is a Test Document

] While IterNo() <= Len(MyText);

MVP
MVP

Re: Reverse string character order

Hi,

Create a macro code in script and call that macro function in script, refer below links for reference

Using Macro functions in Script

Calling VB function (macro) in Load script to find common string length in two strings

You can use below macro for string reverse

Data:

LOAD

*,

StrRev(Str1) AS StrRev

INLINE [

Str1, Str2

China, Chinna

abc, abc

];

Macro:

Function StrRev(str)

StrRev = StrReverse(str)

End Function

Regards,

Jagan.