Dynamic CRM 2011 SOAP RetrieveMultiple xml for querying from two table - soap

I was stuck with Dynamics CRM 2011. I want to create SOAP RetrieveMultiple xml which will fetched the data from two different table using inner join on the basis foreign key.
I have tried many ways but unable to get success.
For my scenarios let's say table A and B is there.
A -- (id, name, address_id)
B -- (srno, address_id, area, city, zip)
Now, I want to get the details from table A & B based on below query,
select A.id, A.name, B.area, B.city, B.zip
from A
INNER JOIN B
ON A.address_id = B.address_id
I'm totally new with Dynamics CRM 2011.
It would be great if you can share some valuable examples.
Thanks in advance.
My SOAP XML
<s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'>
<s:Body>
<RetrieveMultiple xmlns='http://schemas.microsoft.com/xrm/2011/Contracts/Services' xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>
<query i:type='a:QueryExpression' xmlns:a='http://schemas.microsoft.com/xrm/2011/Contracts'>
<a:EntityName>A</a:EntityName>
<a:ColumnSet>
<a:AllColumns>false</a:AllColumns>
<a:Columns xmlns:b='http://schemas.microsoft.com/2003/10/Serialization/Arrays'>
<b:string>name</b:string>
<b:string>area</b:string>
<b:string>city</b:string>
<b:string>zip</b:string>
</a:Columns>
</a:ColumnSet>
<a:Distinct>address_id</a:Distinct>
<a:LinkEntities>
<a:LinkEntity>
<a:LinkFromAttributeName>address_id</a:LinkFromAttributeName>
<a:LinkFromEntityName>A</a:LinkFromEntityName>
<a:LinkToEntityName>B</a:LinkToEntityName>
<a:LinkToAttributeName>address_id</a:LinkToAttributeName>
<a:JoinOperator>Inner</a:JoinOperator>
<a:LinkCriteria>
<a:FilterOperator>And</a:FilterOperator>
<a:Conditions>
<a:Condition>
<a:AttributeName>address_id</a:AttributeName>
<a:Operator>Equal</a:Operator>
<a:Values>
<a:Value xsi:type="xsd:string">123454</q1:Value>
</a:Values>
</a:Condition>
</a:Conditions>
</a:LinkCriteria>
</a:LinkEntity>
</a:LinkEntities>
</query>
</RetrieveMultiple>
</s:Body>
</s:Envelope>
Regards,
Ashish Mishra

You can only do inner joins between related entities (1:N), where a.Id = b.aId you need to Retrieve A records from that address and B records from that address.

Related

Postgres SELECT id LAG(id) OVER (ORDER BY id) FROM invoice WHERE id = 2

I've looked all over the internet and I fail to get this query running as expected.
I've got a table of invoices and some invoices are related to one another because they belong to the same project.
My ticket says I've got to get the PREVIOUS invoice based on a provided invoice.
Say Project A has 10 invoices, and I'm looking at invoice #4, I've got to write a query which will return the ID of the previous Invoice. Bear in mind, the invoice table is home to all sorts of projects, and each project could have many invoices on their own, so I want to avoid getting many IDs back and then iterating over them.
To illustrate the issue, I've written this fiddle.
It works somewhat acceptably when I don't filter for steps.id, but that means returning hundreds of IDs to sift through.
I've tried and tried but I can't seem to get the column previousStep to be kind of bound to the ID column.
Simply find the invoice with the next largest id for the same project:
SELECT inv2.id
FROM invoice AS inv1
JOIN invoice AS inv2
ON inv1.project = inv2.project AND inv1.id > inv2.id
WHERE inv1.id = 1057638
ORDER BY inv2.id DESC
LIMIT 1;

How to fetch data from multi tables in nosql using SEMBAST plugin

I am not able to fetch data when multi table which are having relationship . so can any one help as per the below image
finally i need data like
ORDER_ID, USER_FULL_NAME, PRODUCT_NAME, PRODUCT_PRICE from 3 different table .
please help me out.
Sembast, does not provide a way to query multiple stores in one join query. However getting an entity by id (here a user or a product) is almost immediate (store.record(id).get(db) or store.records(ids).get(db)) so I think your best bet is to query the order_items store and fetch the users and products by ids.
Basically using 3 requests in a transaction to ensure data integrity should perform the join you want.

Is it possible to merge two simple DB queries to get a single reply containing a hash

in my blog-like app, i have two separate queries;
Select id, title, content from posts where id ='$a_post_id'
and
Select tagname, tagscore from tags where postid ='$a_post_id'
Since my db is hosted on a different server from my app, my major performance issue is with the server request roudabout for both the queries.
I was wondering if I can merge the two queries into a single query so that the expected output is
postdetails for '$a_post_id'= id, title, content, tags (hash of tagname, tagscore)
Something similar to a join but where the rows are asymmetrical. Or join returning hashes...
Also, this sounds like a great fix to a simple issue, but am I missing something here? Assuming that this solution is possible, are there any obvioud cons associated with it?
If a JSON key/value pair is OK, you can something like this:
select p.id, p.title, p.content,
jsonb_object_agg(t.tagname, t.tagscore) as tags
from posts p
left join tags t on t.postid = p.id
where p.id ='$a_post_id'
group by p.id;
The above assumes that posts.id is defined as the primary key
Online example: https://rextester.com/RDQX27041

Talend Post Service

I'm trying to post data into 2 tables which are patient table and phone table.
These 2 tables mapped by another table patient_phone. This table contains patient_id(**patient table**) and phone_id(phone table).
So I have to join 3 tables to post some fields to both patient table and phone table.
I did it for get data, it's working fine.These images show how I did to get data
and
But I didn't find any solution, how to join these tables for posting. This shows how I tried to post data:
Help me to get the solution. Thanks in advance

List All domains and data sources use in the domains in Jaspersoft

How can i List All domains and data sources use in the domains in Jaspersoft.
i mean i have different domains like audit domains,customer domain etc is there any way to get all domains with tables(Data sources) use in these domains in jaspersoft?
I have around 20 domains and manually going to each domain and listing tables is cubersome so i need some help!
there is not a good way that i have found (i am sure you can dig into the DB)
one way to get this is to export the domains and it exports to a nice neat XML file.
As we only use JDBC sources we only need to look for "jdbcTable" and "jdbcQuery" tags to see what a domain is using this is all in the second 1/2 of the xml. if you use other datasources you may nee to review the xml to see how Jasper references them in the XML.
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.jaspersoft.com/2007/SL/XMLSchema" version="1.0">
<resources>
<jdbcTable id="" datasourceId="" tableName="">
<jdbcQuery id="" datasourceId="">
<query> select * from table <\query>
Below solution is for identifying Adhoc Views that depend on Domains, but I believe you could implement a similar solution with domains that depend on Datasources.
In the domain I created a derived table [AdhocViewName].
The query for this domain is:
SELECT a.id as AdhocID,
r.label as AdhocLabel,
a.reportDataSource as AdhocDataSourceID,
t.AdhocDataSourceLabel
FROM (SELECT id as AdhocDataSourceID,
label as AdhocDataSourceLabel
FROM public.jiresource
) as t
INNER JOIN public.jiadhocdataview a ON a.reportDataSource = t.AdhocDataSourceID
INNER JOIN public.jiresource r ON a.id = r.id
Notes:
even though the tables appear with underscore (public_jiresource, the query only worked by substituting "." (public.jiresource).
for some reason jasper doesn't like it when you use brackets; eg, a.id [AdhocID], thus I used a.id as AdhocID.
When you pull the derived table into an Adhoc View,
create a table
filter with resourcetype is one of SemanticLayerDataSource, AdhocDataView
Colums: Resource Label, uri
Groups: adhocdatasourcelabel