topic Re: Extract partial text from a field based on multiple conditions in Alteryx Designer Discussions
https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Extract-partial-text-from-a-field-based-on-multiple-conditions/m-p/498221#M102457
<P>Let's say they are grouped and the logic works for them. Now, how to include the logic such that even below works for those which are not grouped (unique ones)</P><P> </P><P> </P><TABLE><TBODY><TR><TD>38050</TD><TD>In</TD><TD>d</TD><TD>……………..ENTYrh500067ABC…….</TD><TD>ENTYrh500067ABC</TD></TR></TBODY></TABLE>Wed, 04 Dec 2019 13:14:29 GMTPranee_0072019-12-04T13:14:29ZExtract partial text from a field based on multiple conditions
https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Extract-partial-text-from-a-field-based-on-multiple-conditions/m-p/498191#M102442
<P>Hi Team,</P><P> </P><P>I want the output to be as below in sample data.</P><P> </P><P>1.If account number starts with 00 and the amount and text matches with another line item for which account number starts with 38, then I want the output to be the second number (ENTYrd000008ABC). Here I want the logic to remove space and / between EN and TY.</P><P>2 If account number starts with 38 and the amount and text matches with another line item for which account number starts with 00, then I want the output to be the first number (ENTYrh400006ABC).</P><P>3. The dots in text data mentions any random data that will be present.</P><P> </P><P>Can this be accomplished if we have lot of data.</P><P> </P><P>Please let me now if you have any questions.</P><P> </P><P>Sample Data:</P><TABLE><TBODY><TR><TD>Ac No</TD><TD>Desc</TD><TD>Amount</TD><TD>Text</TD><TD>Output</TD></TR><TR><TD>00942</TD><TD>Out</TD><TD>a</TD><TD>……………..ENTYrh400006ABCEN /TYrd000008ABC…….</TD><TD>ENTYrd000008ABC</TD></TR><TR><TD>38047</TD><TD>In</TD><TD>a</TD><TD>……………..ENTYrh400006ABCEN /TYrd000008ABC…….</TD><TD>ENTYrh400006ABC</TD></TR><TR><TD>00943</TD><TD>Out</TD><TD>b</TD><TD>……………..ENTYrh400007DEFEN /TYrd000011DEF…….</TD><TD>ENTYrd000011DEF</TD></TR><TR><TD>38048</TD><TD>In</TD><TD>b</TD><TD>……………..ENTYrh400007DEFEN /TYrd000011DEF…….</TD><TD>ENTYrh400007DEF</TD></TR><TR><TD>00946</TD><TD>Out</TD><TD>c</TD><TD>……………..ENTYrh500006ABCEN /TYrd000078KLM…….</TD><TD>ENTYrd000078KLM</TD></TR><TR><TD>38049</TD><TD>In</TD><TD>c</TD><TD>……………..ENTYrh500006ABCEN /TYrd000078KLM…….</TD><TD>ENTYrh500006ABC</TD></TR></TBODY></TABLE>Wed, 04 Dec 2019 11:58:02 GMThttps://community.alteryx.com/t5/Alteryx-Designer-Discussions/Extract-partial-text-from-a-field-based-on-multiple-conditions/m-p/498191#M102442Pranee_0072019-12-04T11:58:02ZRe: Extract partial text from a field based on multiple conditions
https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Extract-partial-text-from-a-field-based-on-multiple-conditions/m-p/498207#M102448
<P>Try this out. I think it matches your desired output, but not sure about edge cases (can there be singletons? Multiple Matches?)</P><P> </P><P>Here we are setting groupby fields and leveraging Conditional Formulas with RegEx to generate the desired output.</P><P> </P><P> </P><LI-CODE lang="python">IF [Text]=[Row-1:Text] && [Amount]=[Row-1:Amount] && toNumber(Substring([Ac No],0,2))=38 THEN
REGEX_Replace([Text], ".*ENTY(.{11}).*", "ENTY$1")
ELSE
REGEX_Replace([Text], ".*\/TY(.{11}).*", "ENTY$1")
ENDIF</LI-CODE><P> </P><P> </P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Snag_1322fd7a.png" style="width: 999px;"><img src="https://pvsmt99345.i.lithium.com/t5/image/serverpage/image-id/88868i0F428D1DF8797BC5/image-size/large?v=1.0&px=999" title="Snag_1322fd7a.png" alt="Snag_1322fd7a.png" /></span></P><P> </P>Wed, 04 Dec 2019 12:44:25 GMThttps://community.alteryx.com/t5/Alteryx-Designer-Discussions/Extract-partial-text-from-a-field-based-on-multiple-conditions/m-p/498207#M102448PeterA2019-12-04T12:44:25ZRe: Extract partial text from a field based on multiple conditions
https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Extract-partial-text-from-a-field-based-on-multiple-conditions/m-p/498218#M102455
<P>Need output as in the snapshot only </P>Wed, 04 Dec 2019 13:11:24 GMThttps://community.alteryx.com/t5/Alteryx-Designer-Discussions/Extract-partial-text-from-a-field-based-on-multiple-conditions/m-p/498218#M102455TirumalaKishore2019-12-04T13:11:24ZRe: Extract partial text from a field based on multiple conditions
https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Extract-partial-text-from-a-field-based-on-multiple-conditions/m-p/498221#M102457
<P>Let's say they are grouped and the logic works for them. Now, how to include the logic such that even below works for those which are not grouped (unique ones)</P><P> </P><P> </P><TABLE><TBODY><TR><TD>38050</TD><TD>In</TD><TD>d</TD><TD>……………..ENTYrh500067ABC…….</TD><TD>ENTYrh500067ABC</TD></TR></TBODY></TABLE>Wed, 04 Dec 2019 13:14:29 GMThttps://community.alteryx.com/t5/Alteryx-Designer-Discussions/Extract-partial-text-from-a-field-based-on-multiple-conditions/m-p/498221#M102457Pranee_0072019-12-04T13:14:29Z