Hi All,
I am trying to use the SharePoint Activities to automate an internal process.
I need help writing the CAML query for the UpdateListItems Activity.
When I try it with a static query as below, it works.
<Where>
<Eq>
<FieldRef Name='EshopPackageReference' />
<Value Type='Text'>6001062902852</Value>
</Eq>
</Where>
But when I try to replace the reference number 6001062902852 with the current row variable of by For Each Row activity, I get an error.
Dynamic Query:
<Where>
<Eq>
<FieldRef Name='EshopPackageReference' />
<Value Type='Text'>"+CurrentRow(0)+"</Value>
</Eq>
</Where>
The error I get is below:
Compiler error(s) encountered processing expression ""<Where>
<Eq>
<FieldRef Name='EshopPackageReference' />
<Value Type='Text'>"+CurrentRow(0)+"</Value>
</Eq>
</Where>"".
String constants must end with a double quote.
Alternatively, is there a better/faster way doing this other than the For Each Row activity?
Something like below (SQL Example)
Where 'EshopPackageReference' In (Ref1,Ref2,Ref3....)
Achal_Desai:
>"+CurrentRow(0)+
Hi
You are almost done
Try mentioning like this
’ "+CurrentRow(0).ToString+“ ‘
With a single quotes on either side
Cheers @Achal_Desai
Thanks for the quick reply @Palaniyappan
But still getting the same error
Can you get your mouse there to the red mark and share the error message
@Achal_Desai
@Palaniyappan , it’s the same error message I have mentioned in the topic.
Hi @Achal_Desai ,
You can try the query as
String.Format(“{0}”, CurrentRow(0).tostring)
sorry i didn’t check the preview how it looks. As some the query directly cant paste you can see the screen shot highlighted CAML query
Please type in from your once again as if it is been copied and pasted in UiPath studio the direction of the double quotes will change at times
So please type in once and give a try
Or
use like this
Let’s take like this value is In a input variable named str_input
Like this in a assign activity
Str_input =
“
“+{0}+”
“
Then use a assign activity like this
str_output = String.Format(Str_input.ToString,currentrow(0).ToString).ToString
Cheers @Achal_Desai
Achal_Desai
(Achal Desai)
September 14, 2021, 10:00am
8
Thanks @manjula_rajendran , this worked.
Could you please explain what this workaround is?
I still have other operations I need to do and most likely will need this workaround every time.
prasath_S
(prasath S)
September 14, 2021, 10:04am
9
Hi @Achal_Desai .
See if it works.
You don’t need to change everything thing in your project,the error occurs due to the line breaks on the string.
For example : instead of using like this
“Where
Eq
Eq
Where”
Use like this,
“Where Eq Eq Where”
without entering the enter key (line break)
It have to be in single line instead of multiple line.
Thanks
system
(system)
Closed
September 17, 2021, 10:04am
10
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.