03-11-23 01:51 PM
Hi all,
Struggling to find an answer to this. I'm hoping someone has experienced and addressed an issue similar to what I'm having - so basically I'm loading a spreadsheet into a collection which is fine, but the issue in trying to resolve is sometimes the headers will change and can be like -
Acc_Num,
Account_Number
Ac_Num
The Customer number can/will be in the same predicament
I' need these fields to always be Account Number & Customer Number, can anybody suggest the best way to do this?
I hope this makes sense. Example picture below -
Thanks in advanced
------------------------------
Dhiren Patel
Robotic Process Automation Developer
Leeds Building Society
Europe/London
------------------------------
03-11-23 02:35 PM
If the Account Number and Customer Number fields always come in at the first and second position, you can use the "Set Column Names From Expected Collection" action in BP's "Utility - Collection Manipulation" VBO. You just use a "Expected Fields/Columns" collection with those two field names (you don't have to list the other field names) and it will rename those two fields.
03-11-23 03:22 PM
Hi - thanks for your reply. I wish they did! unfortunately they could be scattered around the input feed!
03-11-23 05:04 PM
Hello, one possibility is to use logic with a list of similar recurrences but it is not very safe, I believe that the safest way is to normalize the input, check if the requirement cannot be standardized, or if there is another possibility of extraction. Have you tried exporting this spreadsheet using other methods? Via database, changing the export type, etc? Is the input always the same?
Regards,
------------------------------
Leonardo Soares
RPA Developer Tech Leader
Bridge Consulting
América/Brazil
------------------------------
03-11-23 06:25 PM
You could use stages similiar to the following:
"^(Ac_Num|Account_Number|Acc_Num)$"
This assumes that you never get a field called "Customer Number" but if you did sometimes you can use the "Collection Contains Value" action with the "Exact Value" parameter to make a decision around all the above blue section stages.
06-11-23 11:19 AM
Before reading the data, do a Search/Replace on the top line to normalise any variants of Account Number and Customer Number. Then read the data, then close the file without saving changes. For this to work you have to know what the variants could be.
06-11-23 11:48 AM
Hi @DhirenPatel
A simple solution might be to do a find and replace in excel but if not then you can get the worksheet/range as a collection (dont define the collection headers as this might cause an error). Use Get Fields action then loop and using a decision stage look for a name that closely matches what you are looking for e.g. the decision could have StartsWith(Lower([Fields.Name]), "ac") AND InStr(([Fields.Name]),"nu")>0 to match as account number. If true then use the action Rename Field to change the field to what you need.