Extract Data Table Double Spaces

I am encountering an issue where my data table is removing double spaces when extracting from Microsoft Edge. The problem is that I need to use the output in its exact original format (including double spaces) as I pass it out as a variable to click on. Is there any way to stop the data table from removing additional spaces? Thanks.

@James_Grace

Is it removing in datascrapping? While using extract datatable activity?

Can you please specify or ahow where it is happening and from Where the double spaces are getting removed

Cheers

Hi @Anil_G, thanks for the fast reply. It is happening during the actual extraction when using the ‘Data Scraping Wizard’. I can see on the screen that the text has 2 spaces but when the wizard previews it, the additional space is removed. Also, when I put a write line in to show the value using: ExtractDataTable(0).item(0).tostring, the additional space is missing.

@James_Grace
By default, data tables in UiPath will remove extra white spaces from extracted text to make it more uniform and easier to work with. However, if you need to preserve the exact original format of the text (including double spaces), you can use the “PreserveFormat” option of the “Extract Structured Data” activity.

Hi @ABHIMANYU_THITE1 , thanks for your reply. I cannot see an option within the extract structured data table activity that will allow me to preserve the formatting:

@James_Grace

May be you can try one thing…whenever you click…use the text normally first…if it fails replace space with double apace and try again…that might help in identifying as a workaround

Cheers

Unfortunately that wont help, especially as its dynamic and can sometime be more than 2 spaces and could be anywhere in the string.

@James_Grace

Then you can use regex selector and replace space with space* so tht it checks for any number of spaces at the same time

Str.Replace(" "," *")

And in the click selector use mathcing:innertext=‘regex’

Cheers

Hi @James_Grace ,

Maybe we could check with the approach of Find Children Activity if we will be able to preserve the value format as is.

Could you try using the Find Children Activity and let us know if that helps you.

Thanks, that sounds like a potential solution. I’ve never used Regex within a selector before, how would I format this? strAttachment name is the variable that I would need to apply the regex to. My current selector for the click is:

webctrl aaname=‘{{strAttachmentName}}’ parentid=‘errand-info-holder’ parentclass=‘item-image-filename’ /

@James_Grace

Now you selector will be like this

<webctrl aaname=‘*{{strAttachmentName}}* ’ parentid=‘errand-info-holder’ parentclass=‘item-image-filename’ matching:aaname=‘regex’ />

And as mentioned earlier you can use strAttachmentName.Replace(" "," *") before passing it in the selector…

Hope this helps

Cheers

@Anil_G Should the strAttachmentName.Replace(" “,” *") be within an assign activity before the click? I’ve tried doing that and it generates an error as it looks for an actual asterisk as opposed to wildcarding it. I get the below error:

@James_Grace

Yes it should be done in an assig before the original click.

But I see there are other special characters as well…like dot is considered as any character instead of actual do in regex…So I guess those are also to be escaped with \.

It does wild card that…To confirm can you hardcode the exact value and repalce with * in the selector directly and see if it si highlighting…accordingly the regex can be constructed

cheers

1 Like