I needed to create a variable in openRPA with default value to Null, I tried different ways (null, Null, None).
After asking ChatGPT he told me that in Visual Basic you can create a null variable with DBNull or Nothing.
I tried the first option and OpenRPA returned error, after trying the second option and setting the variable as Nothing it seems that the workflow crashes. how can I fix the problem? in which path are the workflows saved to be able to modify the XML?
and since I open thread to report this error and OpenRPA prevents the assignment of a variable to Nothing… how can I create a variable with default value to Null?
System.Xml.XmlException: 'All' is an unexpected token. The expected token is '='. Line 1, position 86.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseAttributes()
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Activities.Debugger.XmlReaderWithSourceLocation.Read()
at System.Xaml.XmlCompatibilityReader.Read()
at MS.Internal.Xaml.Parser.XamlScanner.DoXmlRead()
at MS.Internal.Xaml.Parser.XamlPullParser.<Parse>d__4.MoveNext()
at MS.Internal.Xaml.NodeStreamSorter.StartNewNodeStreamWithSettingsPreamble()
at MS.Internal.Xaml.NodeStreamSorter..ctor(XamlParserContext context, XamlPullParser parser, XamlXmlReaderSettings settings, Dictionary`2 xmlnsDictionary)
at System.Xaml.XamlXmlReader.Initialize(XmlReader givenXmlReader, XamlSchemaContext schemaContext, XamlXmlReaderSettings settings)
at System.Activities.Debugger.XamlDebuggerXmlReader..ctor(TextReader underlyingTextReader, XamlSchemaContext schemaContext, Assembly localAssembly)
at Microsoft.Activities.Presentation.Xaml.WorkflowDesignerXamlHelper.DeserializeString(String text, DeserializationMode mode, IList`1& loadErrors, Dictionary`2& sourceLocations)
at Microsoft.Activities.Presentation.Xaml.WorkflowDesignerXamlHelper.DeserializeString(String text, IList`1& loadErrors, Dictionary`2& sourceLocations)
at Microsoft.Activities.Presentation.Xaml.WorkflowDesignerXamlHelper.SerializeToString(Object obj, String fileName)
at System.Activities.Presentation.WorkflowDesigner.WriteModelToText(String fileName)
In VB, Null is called Nothing. DBNull is something different that is used when working with ADO.
Select the workflow in the main window and click Edit XAML, or better yet, if you are using OpenCore, you can find the workflow in the OpenRPA collection (under entities) and click history to try downloading an older version.
I kept testing, closing and reopening the workflow in OpenRPA solved the error, but the problem persists even when I don’t use Nothing.
I have a String argument, with IN address, if I put any default value, OpenRPA crashes when saving the workflow, is it normal being an argument, can you replicate it to see if you have the same problem?
System.Xml.XmlException: 'All' is an unexpected token. The expected token is '='. Line 1, position 86.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseAttributes()
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Activities.Debugger.XmlReaderWithSourceLocation.Read()
at System.Xaml.XmlCompatibilityReader.Read()
at MS.Internal.Xaml.Parser.XamlScanner.DoXmlRead()
at MS.Internal.Xaml.Parser.XamlPullParser.<Parse>d__4.MoveNext()
at MS.Internal.Xaml.NodeStreamSorter.StartNewNodeStreamWithSettingsPreamble()
at MS.Internal.Xaml.NodeStreamSorter..ctor(XamlParserContext context, XamlPullParser parser, XamlXmlReaderSettings settings, Dictionary`2 xmlnsDictionary)
at System.Xaml.XamlXmlReader.Initialize(XmlReader givenXmlReader, XamlSchemaContext schemaContext, XamlXmlReaderSettings settings)
at System.Activities.Debugger.XamlDebuggerXmlReader..ctor(TextReader underlyingTextReader, XamlSchemaContext schemaContext, Assembly localAssembly)
at Microsoft.Activities.Presentation.Xaml.WorkflowDesignerXamlHelper.DeserializeString(String text, DeserializationMode mode, IList`1& loadErrors, Dictionary`2& sourceLocations)
at Microsoft.Activities.Presentation.Xaml.WorkflowDesignerXamlHelper.DeserializeString(String text, IList`1& loadErrors, Dictionary`2& sourceLocations)
at Microsoft.Activities.Presentation.Xaml.WorkflowDesignerXamlHelper.SerializeToString(Object obj, String fileName)
at System.Activities.Presentation.WorkflowDesigner.WriteModelToText(String fileName)
I don’t know, I never tried using nothing as a default value since it’s redundant. It is nothing if you don’t set it. And you check it using String.IsNullOrEmpty.
But the error is referring to a place where it found the value all, does not sound like setting a variable’s default value to Nothing would give that error. Could you share a stripped down version of the workflow that will fail when you set a default value?
The workflow was very simple, it was to connect to a DB and do a SELECT.
"SELECT * FROM OpenRPA_Tickets
WHERE '" & source_platform.ToString & "' IS NULL OR source_platform =
'" & source_platform.ToString & "'
The select was something like this, it is possible that there is an error, I have found another way to do it and I no longer have the error.
With this error I got that if the variable was NULL the select returned me all the results and if the variable was different to null it made a filter.
But when I want to add a default value to the variable, the workflow crashes.
In the end I solved it by doing an if, if the variable is different from null I make a select with filter and if not, no. (The SELECT was to save me to do an if).
I continue with the thread in case I can help the project and we can find a bug and fix it, but the problem is already solved.
Allan, if you don’t think it’s necessary, we can close the thread.