Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
idogridish2
Not applicable

reverse string in Qlik Sense

Hi All,

when using QV i am using a macro code to reverse a string,

how can i do this in Qlik Sense?

because there is no macro in Qlik Sense.

Thanks.

Tags (1)
4 Replies
Gysbert_Wassenaar
Not applicable

Re: reverse string in Qlik Sense

This should work:Reverse string


talk is cheap, supply exceeds demand
idogridish2
Not applicable

Re: reverse string in Qlik Sense

Thanks a lot Gysbert Wassenaar,

but is there a function you know that i can wrap the field with?

like flip(mytext)?

and if not, is there a way to build something like this?

idogridish2
Not applicable

Re: reverse string in Qlik Sense

because if i need to reverse two fields in my table i need to read the table twice,

and by looking at the code the table is expended as the length of "mytext" field and than shranked to her previous size.

Many thanks again.

Gysbert_Wassenaar
Not applicable

Re: reverse string in Qlik Sense

No and not as far as I know.

Perhaps you can do something like this:

Strings:

LOAD distinct MyText1 as String FROM source;

CONCATENATE (Strings)

LOAD distinct MyText2 as String FROM source;

..etc...

mapStrings:

MAPPING

LOAD String, concat(Letter,'',-row) as ReversedString GROUP BY String;

LOAD String, iterno() as row, mid(String,IterNo(),1) As Letter

While IterNo() <= len(String);

DROP TABLE Strings;

Result:

LOAD

     MyText1,

     ApplyMap('mapStrings',MyText1) as 1texTyM,

     MyText2,

     ApplyMap('mapStrings',MyText2) as 2texTyM,

     ...other fields

FROM

     source

     ;


talk is cheap, supply exceeds demand