How can we extract variables.requested_by value into excel ?which kind of data type need to use in build table?
<variables.requested_by>jesse</variables.requested_by>
How can we extract variables.requested_by value into excel ?which kind of data type need to use in build table?
<variables.requested_by>jesse</variables.requested_by>
Hey @avnreddy007
The requirement is not fully clear please…
Are you getting XML and you want to convert that into a Data Table
Thanks
#nK
Hi,
<short_description>Return - CTT Process Manager ďż˝ EURLA</short_description>
<variables.requested_by>Annapureddy Venkatanarayanareddy</variables.requested_by>
<variables.requested_by.user_name>avenkata</variables.requested_by.user_name>
<assignment_group>R&D Clin-Med</assignment_group>
<cmdb_ci/>
Application Name = PharmaCM = CTT Process Manager ďż˝ EURLA (RETURN/REMOVE Entitlement) = CTT Process Manager
<variables.customer.email>shivraj.kote@biogen.com</variables.customer.email>
<variables.requested_by.email>annapureddy.venkatanarayanareddy@biogen.com</variables.requested_by.email>
<variables.customer>Shivraj Kote</variables.customer>
<sys_id>ab015fbc1bde09105ba90d8fea4bcb7a</sys_id>
SCTASK0520624
<variables.action_type>Return</variables.action_type>
Open
<variables.customer.user_name>skote</variables.customer.user_name>
<work_notes>04-05-2022 11:17:57 AM - Kiran Jyothikumar Lathika Devi (Work notes) test notes </work_notes>
<variables.title>Return - CTT Process Manager ďż˝ EURLA</variables.title>
<assigned_to/>
this is my response, i need to store<variables.customer>value into excel. Could you please help on this
Hey @avnreddy007
Since you are saying it’s just for only one field, we can go with string manipulation…
str_XML.Substring(str_XML.IndexOf("<variables.customer>"), str_XML.IndexOf("</variables.customer>") - str_XML.IndexOf("<variables.customer>"))
There may be some adjustments required since there is a tradeoff in index function, please try once and let know
Hope this helps
Thanks
#nK
could you please help me out how to map <variables.customer> value in Build data table?
Which kind of data type we need to use and which kind of code need to include in assign value?
Hey @avnreddy007
Just keep the data type as string and in the assign you need to do the following,
dt.Rows(0)("ColName") = str_XML.Substring(str_XML.IndexOf("<variables.customer>"), str_XML.IndexOf("</variables.customer>") - str_XML.IndexOf("<variables.customer>"))
I’m assuming it’s just the first row & used 0 as row index above
Thanks
#nK
Its throwing error?
I have assign data type customer data type as string in build data table and while assigning value:
data.Rows(RowCounter).Item(“Customer”)=str_XML.Substring(str_XML.IndexOf(“<variables.customer>”), str_XML.IndexOf(“</variables.customer>”) - str_XML.IndexOf(“<variables.customer>”))
its throwing error?
What’s the error please…?
Also please replace the variables with originals as per your code… I just used dummy variable names for string and datatable
we would recommend to process XML with XML Apis / Activities
Kindly note: XML snippets will be broken, when not using the format </>
button from editor.
The best option would be:
We are getting below response from service now api. i have extracted some values like<short_description>,but unable to extract <Variables.customer> value.
i have assign value for <Variables.customer> like
data.Rows(RowCounter).Item(“Customer”)=item.SelectToken(“Variables.customer”).ToString
The element name is case sensitive. Have you tested to change "Variables.customer"
to "variables.customer"
?