Simple Query Help Using XRMToolbox - sql

I am using XRMToolbox and its tool "Bulk Data Updater" with Microsoft Dynamics CRM. I need to update a boolean value of multiple accounts after searching for them by account number. I believe it requires some type of JOIN.
I believe I have constructed the proper query, but when I try to Bulk Update (see picture), the attribute of the boolean value I need is not listed in the dropdown menu.
When I run this query:
I get the results needed
I get the specific user_id values I need, and I get their status "approved" which is the boolean value I need to change, but I can not edit these values because "approved" attribute is not listed in the dropdown menu
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" >
<entity name="contact" >
<attribute name="user_id" />
<link-entity name="application" from="applicant" to="contactid" >
<attribute name="approved" />
<link-entity name="contact" from="contactid" to="applicant" >
<filter type="or" >
<condition attribute="user_id" operator="eq" value="0000021" />
<condition attribute="user_id" operator="eq" value="0000055" />
</filter>
</link-entity>
</link-entity>
</entity>
</fetch>

When you want to set fields on an account, you need to query accounts, but you query contacts.

You already chose the XrmToolBox plugin to use for bulk update, but the query is not the expected one to update back the results - i.e., you mentioned account but the query only has contact and application entities joined. So obviously the query is not composed from the right direction.
If you want to update the application entity, build the query in FetchXML builder starting from application entity rather than from related contact side.
Or you can build the Advanced find query to use, (or download the fetchxml from there or even save that Adv.find query as CRM view to use in Bulk Data updater) you can simply export/bulk edit the records in Excel online to save back. You can select 250 records at once to Bulk edit wizard or to run Workflow to update.
Every single approach need the parent entity list from query to update the field. Start over.

Related

Pentaho mondrian cube main sql query

I had a problem while programming a schema in mondrian. The thing is that I want to filter the main query inside the tag of the cube so that it can only access the dimensions taking into account the logged in user. Is there any way to get that value dynamically and add it to the query?
<Cube>
<Annotations>
</Annotations>
<View>
<SQL dialect="generic">
<
select a.*
from xxxxx a where (here is where i want to obtain the username value)
>
</SQL>
</View>
I tried to search in several webpages but I didn't find anything

How to grab values between xml in SQl statement

When I run a SQL against one of the tables, this is the value i get against column instruction
<GiftMessage>
<Properties>
<Property Type="FONT">50</Property>
<Property Type="SCRIPT">512</Property>
<Property Type="CARD">B</Property>
<Property Type="FORMATOPTION">N</Property>
<Property Type="WRTIE">D</Property>
</Properties>
<Line SeqNo="1"><![CDATA[]]></Line>
<Line SeqNo="2"><![CDATA[]]></Line>
<Line SeqNo="3"><![CDATA[]]></Line>
<Line SeqNo="4"><![CDATA[ ***712020line2***]]></Line>
</GiftMessage>
How do i grab the value "712020line2" alone from the column to show in my output query using select statement.
Apologize for late reply,
I am connected to Oracle database using Oracle sql developer, and below is the query we run.
select instruction_text,order_no from INSTRUCTION_DETAIL where instruction_text like '%712020%';
Purpose
We used to place around 50-70 orders and share it with different team for shipment, updating each order on what needs to be done is tedious task, so we are planning to update that instruction with "what action the shipment team needs to do", so at the end of
day, we just run this query and download it to excel and share. But the thing is the instruction_text column value comes out in an xml format, so looking for a way to fetch only the instruction text, like in above case, '712020line2', from that xml

SSRS - Can I probe what reports have what fields like an information schema?

In the same was as one can query the information scehema in SQL Server to get a list of all tables and columns for a database, can one get a list of all the reports and the fields they reference in SSRS?
Is there something akin to an information schema on the reporting server?
I have a list of 800 reports for which I need to extract all fields, so I need this automated.
Any help would be appreciated and thanks in advance.
PS I am a novice SSRS user although I have done advanced VBA and MDX queries within SSRS.
You can read them as XML files
Structure is:
<Report>
<DataSet>
<DataSets>
<Query>
<Field Name="Name1">
<DataField>Name1</DataField>
...
</Field>
<Field Name="Name">
...
</Field>
...

Tool to convert a SQL query into Dynamics CRM FetchXML query

We need a tool that can convert a given well-defined SQL query into it's constituent xml form. Can anyone suggest anything of this sort, a free tool would do great help. Also, can you advise whether FetchXML by MS can be used to achieve this?
We can consider this trivial example to illustrate the requirement...
Input:
select emp_name, emp_id from employee_table where emp_sal > 5000
Output:
<query>
<entity name=”employee_table”>
<attribute name=”emp_name” />
<attribute name=”emp_id”/>
<filter>
<condition attribute=”emp_sal” operator =”>” value=”5000”/>
</filter>
</entity>
</query>
We have recently launched a free online converter which can be used to convert SQL script to CRM FetchXML. The converter is available at http://www.sql2fetchxml.com/. Check it out and let me know if you have any questions about the converter.
Read this: SQL to fetch xml...how to ??

May I only parse one node in xml at one time in sql server?

If I have following xml:
<Main>
<Group>
<Insert />
</Group>
<Group>
<Insert />
</Group>
...
</Main>
I know that if I use openxml(#xml, 'Main/Group/Insert',1), I will parse all <Insert>.
Is there a way I can read only one group node, parse its Insert node and then read the next group node and parse its Insert node?
The OpenXML or newer XML datatype and XPath treat the XML as a table, extracting and treating the results as multiple rows in one go.
What you are asking is equivalent to, for a normal SQL Server table, can you select one record, then read the next record? Of course - such as using cursors or WHILE loop -, but why?
Consider what you want to do with it, and you will soon come around to treating it properly as a dataset and getting the parsed results as records, and applying SET logic to the values you retrieve from it.