String
Moderators: chulett, rschirm, roy
String
Hi all,
My input:
AAAAA = 10000 OR AAAAA = 10000 AND BBBBB = 20000 AND CCCCC = 20000 OR CCCCC=20000 AND DDDDD=30000
Output should be:
(AAAAA = 10000 OR AAAAA = 10000) AND (BBBBB = 20000) AND (CCCCC = 20000 OR CCCCC=20000) AND (DDDDD=30000)
basically all the ORs should be grouped and put into braces from the input.
PLease suggest me to arrive at the desired result.
Thanks,
-M
My input:
AAAAA = 10000 OR AAAAA = 10000 AND BBBBB = 20000 AND CCCCC = 20000 OR CCCCC=20000 AND DDDDD=30000
Output should be:
(AAAAA = 10000 OR AAAAA = 10000) AND (BBBBB = 20000) AND (CCCCC = 20000 OR CCCCC=20000) AND (DDDDD=30000)
basically all the ORs should be grouped and put into braces from the input.
PLease suggest me to arrive at the desired result.
Thanks,
-M
Can you perhaps explain exactly which stage and what columns you have? Are AAAAA, BBBBB, CCCCC column names?
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
ArndW wrote:Can you perhaps explain exactly which stage and what columns you have? Are AAAAA, BBBBB, CCCCC column names? ...
These are not column names... AAAAA, BBBBB are the values as part my test input data stream...i am trying to build a dynamic WHERE clause in transformer stage...this WHERE clause will be used later to query a Oracle stage...
Let me now if you need furthe info
Thanks
-M
This is more along the lines of a buildop in PX. If you can use server jobs then you could do some string manipulation in a loop, I'd use INDEX(In.Col,' OR ') to find the "or" statement, then go back 3 words and prepend a '(' and then go forward 3 words and put in a ')'. That approach is straightforward, but won't work if you have 2 or more ORs in a row.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Yes...Index function is returning the position of my "AND" Keywords...ArndW wrote:This is more along the lines of a buildop in PX. If you can use server jobs then you could do some string manipulation in a loop, I'd use INDEX(In.Col,' OR ') to find the "or" statement, then go back ...
Please give me some hint how to put these into a loop to find position of all the AND keywords in a particulare record...
My idea is to replace all the' AND ' with ') AND (' with some more additional adjustments. In this way i can brackets for all my OR keywords.
But i could not figure out CHANGE function or EREPLACE function in the transformer.
Is there a more elegant way to acheive this!!!
V'TH LUV
The "EREPLACE" function doesn't exist in the PX transform stage, so the external sed function, perhaps in a wrapper, will work but might be just as slow as using a BASIC transform stage. In that case, it would be better to evaluate writing this job in Server.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Hi Arndw,ArndW wrote:The "EREPLACE" function doesn't exist in the PX transform stage, so the external sed function, perhaps in a wrapper, will work but might be just as slow as using a BASIC transform stage. In that case, ...
your suggesstions are not appearing till the end...Some premium content icon comes in between so i could not get your suggesstions entirely. IS that a way to get rid of this??
That particular post only had a couple more words to it, but it is certainly worthwhile getting a premium membership.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>