atarantino
(Atarantino)
February 14, 2023, 1:04pm
1
I’ve been running this process for weeks unattended no issues. All of a sudden today i get an error saying “Assign: Syntax error: Missing operand after ‘s’ operator.”.
This is the assign that gets the error. I tried deleting the assign and retyping everything (suggestion i saw on another post) but that didn’t fix the error.
HI @atarantino
Checkout this Expression
dtDefendants.AsEnumerable().Where(Function(d) d("Defendant").ToString.Equals(CurrentRow("Defendants").ToString)).CopyToDataTable
Regards
Sudharsan
Try this:
dtDefendants.Select(“Defendant = '” + CurrentRow(“Defendants”).ToString() + “'”)
try this @atarantino
dtDefendants.AsEnumerable().Where(Function(d) d("Defendant").ToString.Equals(CurrentRow("Defendants").ToString)).ToArray().CopyToDataTable
Can you try this @atarantino
dtDefendants.Select("[Defendant ]='"+CurrentRow["Defendants"].Tostring+"'")
Regards
Sudharsan
atarantino
(Atarantino)
February 14, 2023, 1:57pm
9
Doesn’t work. I get the same error.
Yoichi
(Yoichi)
February 14, 2023, 2:10pm
10
Hi,
I guess this error is caused by single quote in CurrentRow(“Defendant”) such as “One’s”.
For now, can you try the following expression?
dtDefendants.Select("Defendant = '"+CurrentRow("Defendant").ToString.Replace("'","''")+"'")
Regards,
postwick
(Paul)
February 14, 2023, 2:42pm
11
You have a value in CurrentRow(“Defendants”) that has an apostrophe in it. Looks like probably 's in one of the values.
What is the variable datatype of DefendantRecord? @atarantino
atarantino
(Atarantino)
February 14, 2023, 2:51pm
13
I solved it. My data had a ’ in it so i did a .replace(“'”, “”) and it works.
postwick
(Paul)
February 14, 2023, 2:58pm
14
You won’t get the error now, but your Select won’t work.
Say the value is “Arnold’s” inside dtDefendants. Now your select is “Defendant = ‘Arnolds’” which won’t match.
The correct way to solve it is to escape the single quote by replacing it with two single quotes.
atarantino
(Atarantino)
February 14, 2023, 4:09pm
15
can you please help me with the code?
this is what i have after my change
dtDefendants.Select(“Defendant = '”+CurrentRow(“Defendants”).ToString.Replace(“'”,“”)+“'”)
postwick
(Paul)
February 14, 2023, 4:21pm
16
Just put two single quotes in your replace statement in the second parameter.
dtDefendants.Select(“Defendant = ‘”+CurrentRow(“Defendants”).ToString.Replace(“’”,“‘’”)+“'”)
It’s hard to see, but the second parameter in the .Replace(, ) is now a double quote then two single quotes then a double quote.
What this does is escape the single quote so the Select knows to treat it as part of the value, not part of the syntax.
Note that you can’t copy/paste from here into Studio. The quotes won’t be correct.
1 Like
atarantino
(Atarantino)
February 14, 2023, 4:55pm
17
No worries - i put it in notepad and was able to see it better. I really appreciate the help.
1 Like
system
(system)
Closed
February 17, 2023, 4:55pm
18
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.