I am learning how to extract text from PDF and for some reason when i want to extract the number on it as integer after changing the scope as Integer, i get the below error and UiPath wont allow me to run the project. i m following the Udemy videos for a project and they use integer in their scope without any issue.
Hi @Smit_Jain ,
Could you maybe convert your variable type to String and check if it is able to work ?
For retrieving the data using Get Text
or Get Attribute
activity, we keep the type as UiPath.Core.GenericValue
and it should be able to adapt to any of the retrieved types.
We can then convert the extracted value to the required type.
I get this now. i am simply following a video so i dont fully understand what my mistake is. i mean no problem with changing but intention is using ‘get text’, extract the invoice number and then it takes too long leading to this error. what is my mistake?
The other thing is the video i am following is basically extracting not just from one but from 1000 invoices. i want to understand my error so this wont happen again. but even when following a video, i get these kind of errors.
Hi
Welcome to the community
By using get text activity it give only string ouput we cant change its output type
So what you can do is
Yourintegervariable=cint(gettextoutputvariable)
Cint is converting to integer
Cheers
Hi
If you are getting a string from PDF extraction and need to convert it to an integer, use the CInt()
function in UiPath to perform the conversion. For example:
YourIntegerVariable = CInt(ExtractedStringVariable)
Make sure that the extracted string can be successfully converted to an integer. If the string contains non-numeric characters or is empty, this conversion can fail and lead to errors.
Thanks!!
how would i type that variable in on write line or log message activities? like this?
InvoiceVariable = CInt(InvoiceVariable)
Pass the InvoiceVariable in write line or log message to print its value or you can check the localwindow panel to check its value.
You can type like that
Or
Take a assign activity
InvoiceVariable = CInt(InvoiceVariable)
Pass only invoicevariable
In the log message
as requested i place the assign activity and still same error i am struggling with. the integer to string issue. do i flip them?
now i get this. any suggestions?
Your need to create a output for gettext activity as example as stroutput
And pass that output in the below mentioned
Take assign activity
Invoicenumber=cint(stroutput)
Here invoicenumber is a new variable of type int32
Cheers
hi Shiva,
that one problem is now solved. however some reason i keep getting this one error where it says target element is disabled. is it because my get text activity is taking too long in extracting the element i want to extract?
I already solved. thanks all for your help