with the reference to sample data in PDI
C:\pdi-ce-5.2.0.0-209\data-integration\samples\transformations\Switch-Case - substring example.ktr
the output of this .ktr is such that it sends data across the step matching the string. But what if I want to forward the string that is been mentioned and not the entire line containing the string. for e.g the Case value mentioned in switch is
and the target step mentioned is in dummy step with as world,hello,others(for defaults)
the output(in dummy step) shows the occurrence of the word that was specified,but here I just want only the word the we mention in case value.
I tried inserting space after the word world and hello but it didn't worked.seeking help for the same.
Related
This is probably a stupid question but I can't figure out for the life of me which step would allow the last two character of a string to be deleted in Pentaho Data Integration V9.2
There are many ways to do that, perhaps the simplest is a Replace in strings step, using a Regex (e.g., search for (.*).{2} and replace by $1).
This will replace the entire string by the first capture group, which is made up of the entire string except the last two characters.
I have numerous files where the address field is in a single line of text, for the most part separated by a comma. My first step is using 'Replace' function in Excel to replace comma's with a carriage return. This is to turn an address from a single line into multiple lines.
The issue I'm looking to get assistance with, is when I complete the steps above, a leading space is often remaining in all rows from the second row onwards. I would like to know the best way to remove the leading spaces in these rows and keep the format of multi-line addresses.
I have tried using TRIM however these returns the address back to a single line
To show the pre and post transformed data I've added an image below as I can't seem to get the format to show correctly here on this post. Due to my profile being new I also can't imbed the image so there is a link below showing the pre and post transformed data, and the leading space issue I'm seeking help with
Pre and Post Example
Thanks,
Steve
As #Anonymous mention in comment, replace both comma and space at a time by SUBSTITUTE() formula and use WRAP TEXT format of resulting cell.
=SUBSTITUTE(A2,", ",CHAR(10))
String:
"Department=Acc:2";"Classes=Accessoire";"Suppliers=xxx23";"Category=Décor";"Discount=no";Related_Carousel_Products=[23043]";"Accessory Type=Crinolines et Shorts";
My excel cells are filled with data like this and I want to extract a specific part of it, for example I would like to extract Accessory Type="Crinoline" into a new column so that I can edit them separately. I've tried this article it has many creative ways to extract the data but I cannot find a way to extract in the way I want, I want to extract part of the string, including the quotes.
https://www.extendoffice.com/documents/excel/3639-excel-extract-part-of-string.html
UPDATED - screenshot showing breakdown of each key function
You can do this using mid + search as follows (screenshot below/this sheet refer):
=MID(B2,SEARCH($F$2,B2),SEARCH(";",MID(B2,SEARCH($F$2,B2)+1,LEN(B2))))
where:
B2: the raw text
F2 = 'Accessory Type' (or any other thing you specify that satisfies final bullet)
Entire string you want to return (with or without quotation marks) falls after 'Accessory Type' and before the very next semi-colon (;) - per your example/below screenshot/above link.
How does this work?
We need to find the part of text that starts with the selected word(s) (e.g. "Accessory Type" in this case) and ends after the description of that accessory type (in this case, it's made up "asdfhadhgk")
Working from inside out mid function (A) returns everything after the words "Accessory Type"
Great, now we just need to it 'stop' a bit sooner, i.e. after the semi-colon that first appears after the words Accessory. This is exactly what the outer Mid function (D) achieves (it returns the string starting with "Accessory Type" up to the semi colon)
Screenshots below refer.
I have few text files, and I need to subset the subheading data and content of that subheading data and pass to another file.
The text file looks like this
Notes
1. content
2. here also there will be some content till n lines
rule Note
1. n line content (a) for every section
Add Notes
(a) some content
other Note
1. the rest of file
***Code***
with open(file,encoding='utf8') as in_file:
s = in_file.read()
for i, char in enumerate(s):
if s[i:i+5] == 'Notes':
break
for j in range(i,0,-1):
if s[j] == '\n':
break
rest_of_file = s[j+1:]
The above code extract the data from text file from Notes.
so my expected output some thing looks like this in 1st iteration and need to pass to another file
Notes
1. content
2. here also there will be some content till n lines
2nd iteration
rule Note
1. n line content (a) for every section
3rd iteration
Add Notes
(a) some content
final iteration
other Note
1. the rest of file
Note: This is one file which has all subheadings with patter but it may not be same for all the text files. some files may miss Notes ,some may miss rule Note and Add Notes,some files may have directly other note like that it may happen
only common pattern i found here is Note
any approach is fine can any one help with this pls...
ready to work with beautiful soup also
The approach for this is
passed everything into list
if Note appears in items get index of item into list
based on indexes list separate it with different sections
sample code is here:
how to get subset of list from index of list in python
I am using loadrunner 12.5. In the below value I need to correlate and get the value 1aqeid!None (the None will also be filled with numbers so its dynamic)
Example:
1. {id:'1aqeid!None!123456',paramName:'jsessionId'};
2. {id:'1aqeid!zxsjfn12536782ldfj!123456',paramName:'jsessionId'};
I need to get only the below value
1. 1aqeid!None
2. 1aqeid!zxsjfn12536782ldfj
web_reg_save_param("ID","LB=id:'","RB=!","ORD=1",LAST);
I am not able to find the solution.
"LB={id:'",
"RB=',paramName:'jsessionID'",
"ORD=ALL",
LAST
This will leave you with:
1aqeid!None!{some value you do not need}
You have a number of options at this point. You could use strtok() and split your string with a '!' as a separator, you could parse the string to find the location of the second instance of the '!' in the character array and then take a substring using strncpy() before that as your value, or..... The point here is that you can collect more than you need and then trim down based upon a known separator in the data.