Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

count position of a specific character

tansh0099
7 - Meteor

Hi everyone,

I am struggling to get multiple position of "X" in a string 
this is a type of unique key wherein I in want to show the positions of only "X" from this string 

 

KeyPositions
FGENDPEXDTX7,10
FGXXXXPXGNT2,3,4,5,7

 

can you guys help me out with this please?

10 REPLIES 10
ShankerV
17 - Castor

Hi @tansh0099 

 

If your Key column is of fixed Length 11, then you can achieve this with the help of Regex tool and Concat using the Summarize tool.

 

Many thanks

Shanker V

Felipe_Ribeir0
16 - Nebula

Hi @tansh0099 

 

One way of doing this

 

Felipe_Ribeir0_0-1670508293648.png

 

 

tansh0099
7 - Meteor

thank you for your solution
my key length is 70
and it's a huge data with 137 columns and out of that one column is this key
earlier due to glitch i was not able to post full key.
my key looks like this:  F____GXXXX_P___XGNT__O____T__T___R________R____B____T_N______NP______C

ShankerV
17 - Castor

Hi @tansh0099 

 

Please find the below solution, as per my understanding.

 

FGENDPEXDTX - X is in 8 and 11. 

Hence the position is 8,11.

 

ShankerV_0-1670510415348.png

 

Many thanks

Shanker V

 

ShankerV
17 - Castor

Hi @tansh0099 

 

If you still need the output as 7,10. Here is the output.

 

ShankerV_0-1670510671817.png

 

tansh0099
7 - Meteor

there are underscores "_" in between the alphabets and that is also to be considered as position
so for F____GXXXX_P___XGNT__O____T__T___R________R____B____T_N______NP______C
position of X would be 6,7,8,9,15
considering starting position (F) to be 0

ShankerV
17 - Castor

Hi @tansh0099 

 

Please find the below workflow which will work for 70 characterset also.

 

ShankerV_0-1670511069218.png

 

Hope your issue is resolved. Feel free to mark helpful answers as a solution, so that future users with the same issue can find them easier!!!!

 

Many thanks

Shanker V

ShankerV
17 - Castor

Hi @tansh0099  

 

I understood the requirement, just posted the latest solution for 70 size characterset with Underscore too.

 

Please check and let me know.

 

Many thanks

Shanker V

Felipe_Ribeir0
16 - Nebula

Hi @tansh0099 

 

Here is my workflow adapted to consider special characters like _

Felipe_Ribeir0_0-1670511685166.png

 

Labels