<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Python Class Instance Blue Prism 'Serialization' in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/Python-Class-Instance-Blue-Prism-Serialization/m-p/99809#M47281</link>
    <description>&lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/2508"&gt;@JeremyFarmer&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;Ok, have you tried looking directly at the table dbo.​BPAWorkQueueItem using SQL Management Studio? That should give you a pretty good view of how collections are stored. Just look at the field titled &lt;STRONG&gt;data&lt;/STRONG&gt;.&lt;BR /&gt;&lt;BR /&gt;Create a test work queue and then throw a Collection with an embedded Collection in it into the test work queue. Then you should be able to work out the format.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Eric</description>
    <pubDate>Wed, 10 Nov 2021 15:56:44 GMT</pubDate>
    <dc:creator>ewilson</dc:creator>
    <dc:date>2021-11-10T15:56:44Z</dc:date>
    <item>
      <title>Python Class Instance Blue Prism 'Serialization'</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Python-Class-Instance-Blue-Prism-Serialization/m-p/99807#M47279</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I'm working on a project that integrates Python and Blue Prism together, we'd like to be able to utilize Blue Prism's work queue system to share work data between the Python script and Blue Prism. We are having trouble handling serialization between Python and Blue Prism's Work Queue Item XML format.&lt;BR /&gt;&lt;BR /&gt;Couple of separate parts to this,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;1. Is there any documentation that explains how Blue Prism de-serializes it's XML format into a collection and vice-versa?&lt;BR /&gt;2. How should de-serialization of nested objects (e.g. class that has a class as a member) be handled? I don't see any way of handling something nested like that so Blue Prism could handle de-serializing it into a collection&lt;BR /&gt;3. How should null values be handled? For example if we have a Optional[int] type in Python that is set to None, how could we represent that in Blue Prism's XML format?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;What we've got working so far is serialization for a single level class, like&amp;nbsp;&lt;BR /&gt;class PythonTestObject:&lt;BR /&gt;def __init__(self, name, number, flag) -&amp;gt; None:&lt;BR /&gt;self.name = name&lt;BR /&gt;self.number = number&lt;BR /&gt;self.flag = flag &lt;BR /&gt;self.created_on = datetime.now()&lt;BR /&gt;&lt;BR /&gt;Will be serialized to&amp;nbsp;&lt;BR /&gt;&amp;lt;collection&amp;gt;&lt;BR /&gt;&amp;lt;row&amp;gt;&lt;BR /&gt;&amp;lt;field name="name" type="text" value="Test"/&amp;gt;&lt;BR /&gt;&amp;lt;field name="number" type="number" value="3"/&amp;gt;&lt;BR /&gt;&amp;lt;field name="flag" type="flag" value="True"/&amp;gt;&lt;BR /&gt;&amp;lt;field name="client_name" type="text" value="test"/&amp;gt;&lt;BR /&gt;&amp;lt;/row&amp;gt;&lt;BR /&gt;&amp;lt;/collection&amp;gt;&lt;BR /&gt;&lt;BR /&gt;Thanks for any insight into any of these questions!&lt;BR /&gt;&lt;BR /&gt;Edit:&amp;nbsp;&lt;BR /&gt;&lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/1353"&gt;@EricWilson1&lt;/a&gt; can't seem to reply to your post...&lt;BR /&gt;We are trying to write directly to the BP database so that we can share data between the script and blue prism.​&lt;BR /&gt;&lt;BR /&gt;New Edit:&amp;nbsp;&lt;BR /&gt;&lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/833"&gt;@ewilson&lt;/a&gt;&lt;BR /&gt;Thanks! Seems like that would work to serialize nested classes - does blue prism have any concept of a null type in the WorkQueueItem data? I don't see any example of that in our instance​&lt;BR /&gt;&lt;BR /&gt;Last Edit:&lt;BR /&gt;Here is what I ended up doing, nested class objects end up as a collection in a collection.&lt;BR /&gt;
&lt;PRE class="language-python"&gt;&lt;CODE&gt;class PythonTestObject:
    def __init__(self, name, number, flag) -&amp;gt; None:
        self.name = name
        self.number = number
        self.flag = flag 
        self.engagement = EngagementEnum.FIRST
        self.client: Optional[Client] = None

class Client:
    def __init__(self, client_name) -&amp;gt; None:
        self.client_name = client_name 

class EngagementEnum(Enum):
    FIRST = 1​&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Ends up as&amp;nbsp;&lt;/P&gt;
&lt;BR /&gt;
&lt;PRE class="language-markup"&gt;&lt;CODE&gt;&amp;lt;collection&amp;gt;
	&amp;lt;row&amp;gt;
		&amp;lt;field name="name" type="text" value="Test"/&amp;gt;
		&amp;lt;field name="number" type="number" value="1"/&amp;gt;
		&amp;lt;field name="flag" type="flag" value="False"/&amp;gt;
		&amp;lt;field name="engagement" type="number" value="1"/&amp;gt;
		&amp;lt;field name="client" type="collection"&amp;gt;
			&amp;lt;row&amp;gt;
				&amp;lt;field name="client_name" type="text" value="MyClient"/&amp;gt;
			&amp;lt;/row&amp;gt;
		&amp;lt;/field&amp;gt;
	&amp;lt;/row&amp;gt;
&amp;lt;/collection&amp;gt;​&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Handling null types by just not inserting the &amp;lt;field&amp;gt;&amp;lt;/field&amp;gt; in the xml, so if for example 'client' is None in Python it ends up as&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-markup"&gt;&lt;CODE&gt;&amp;lt;collection&amp;gt;
	&amp;lt;row&amp;gt;
		&amp;lt;field name="name" type="text" value="Test"/&amp;gt;
		&amp;lt;field name="number" type="number" value="1"/&amp;gt;
		&amp;lt;field name="flag" type="flag" value="False"/&amp;gt;
		&amp;lt;field name="engagement" type="number" value="1"/&amp;gt;
	&amp;lt;/row&amp;gt;
&amp;lt;/collection&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Blue prism seems fine with that, we just have to remember to check for the field existing in Blue Prism before it is used&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 20:49:52 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Python-Class-Instance-Blue-Prism-Serialization/m-p/99807#M47279</guid>
      <dc:creator>JeremyFarmer</dc:creator>
      <dc:date>2021-11-09T20:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: Python Class Instance Blue Prism 'Serialization'</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Python-Class-Instance-Blue-Prism-Serialization/m-p/99808#M47280</link>
      <description>Hi @Jeremy&amp;nbsp;Farmer,&lt;BR /&gt;&lt;BR /&gt;Can you elaborate on what you mean when you say you're trying to integrate Python and Blue Prism? Does this mean you're exposing a Blue Prism VBO or process as a SOAP service and trying to invoke it from Python? Or are you trying to write directly to the BP database?&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Eric​</description>
      <pubDate>Wed, 10 Nov 2021 15:38:09 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Python-Class-Instance-Blue-Prism-Serialization/m-p/99808#M47280</guid>
      <dc:creator>ewilson</dc:creator>
      <dc:date>2021-11-10T15:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: Python Class Instance Blue Prism 'Serialization'</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Python-Class-Instance-Blue-Prism-Serialization/m-p/99809#M47281</link>
      <description>&lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/2508"&gt;@JeremyFarmer&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;Ok, have you tried looking directly at the table dbo.​BPAWorkQueueItem using SQL Management Studio? That should give you a pretty good view of how collections are stored. Just look at the field titled &lt;STRONG&gt;data&lt;/STRONG&gt;.&lt;BR /&gt;&lt;BR /&gt;Create a test work queue and then throw a Collection with an embedded Collection in it into the test work queue. Then you should be able to work out the format.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Eric</description>
      <pubDate>Wed, 10 Nov 2021 15:56:44 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Python-Class-Instance-Blue-Prism-Serialization/m-p/99809#M47281</guid>
      <dc:creator>ewilson</dc:creator>
      <dc:date>2021-11-10T15:56:44Z</dc:date>
    </item>
  </channel>
</rss>

