I am getting a string result from custominput activity as strResult of type String
“112”,“11”,“12”,“Blank”,“Blank”,“Blank”
I have used foreach loop of string type as as exractCustomresult and stored all these values into different variable.
But I want the BOT before assigning thses to diff variables like var1=“112”, var2=“11” etc. It should remove all the “Blank” and extract only values containing digits or data and then assign these to different variable.
Please support
How are you trying to do that @somya177? I provided the solution if you have a string array.use assign activity and then use the above . Then you can directly give the string array in for each activity
Please find my XAML.
I created using the logic u provided but still I get “blank” in the writeline.
I want only the values and remove "blank"FormTest.xaml (10.1 KB) HTMLPage1 -.html (5.7 KB)
@somya177
Please Check in your provided XAML the Cases of “Blank”. In the Where statement is blank written the b in lower case. In your Post above the B is written in uppercase.
Kindly note. splitting a String Variable returns a String Array. So the provided code should do this as expected.
Message: Unable to cast object of type ‘System.Char’ to type ‘System.String’.
Exception Type: System.InvalidCastException
RemoteException wrapping System.InvalidCastException: Unable to cast object of type ‘System.Char’ to type ‘System.String’.
at UiPath.Core.Activities.ForEach1.InternalExecute(NativeActivityContext context, IEnumerator valueEnumerator) at UiPath.Core.Activities.ForEach1.Execute(NativeActivityContext context)
at System.Activities.NativeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
I found the solution and I got results but then I got struck I another thing.:
This is how I am getting the result after assigning logic to the variables;
Now the thing is I need to pass these amount values to the webapplication.
So the BOT has to click on “Continue” button till it doesn’t find empty string i.e splitamount2 in this case and when it gets this empty value it has to click on payment button.
I have used foreach loop to do so i.e. foreach item in extractCustomResult where extractCustomResult is stringtype array and inside foreach I am passing a if condition item.ToString.Equals(String.IsNullOrWhiteSpace)=false then BOt will click on Continue
else click on payment button.
BOT worked fine for first iteration and after second iteration it was supposed to click on Payment but it moved to then part and click on Continue…i.e. it read previous value 11 which is wrong.
can u please support in this
Can You Try String. IsNullOrEmpty function instead of String.IsNullOrWhiteSpace
and change the condition in this way:
String.IsNullOrEmpty(item.ToString)
then: click payment
else: click continue