Tableau MarkLogic Data Modelling -
i using tableau marklogic. have following xml structure
<customerinformation customerid="1"> <customerbasicinformation> <customertitle></customertitle> <customerfirstname></customerfirstname> <customermiddlename></customermiddlename> <customerlastname></customerlastname> </customerbasicinformation> <customeremplyomentdetails> <customeremployer> <employername iscurrentemployer=""></employername> <customerdesignation></customerdesignation> <employerlocation></employerlocation> <customertenure></customertenure> </customeremployer> <customeremplyomentdetails> <polcydetails> <policy policyid=""> <policyname></policyname> <policytype></policytype> <policycategory></policycategory> <quotenumber></quotenumber> <policyclaimdetails> <policyclaim claimid=""> <policyclaimedon></policyclaimedon> <policyclaimtype></policyclaimtype> <policyclaimantname></policyclaimantname> </policyclaim> </policyclaimdetails> <policycomplaintdetails> <policycomplaint complaintid=""> <policycomplaintstatus></policycomplaintstatus> <policycomplainton></policycomplainton> </policycomplaint> </policycomplaintdetails> <billingdetails> <billing billingid=""> <billingamount></billingamount> <billingmode></billingmode> </billing> </billingdetails> </policy> <policy policyid=""> <policyname></policyname> <policytype></policytype> <policycategory></policycategory> <quotenumber></quotenumber> <policyclaimdetails> <policyclaim claimid=""> <policyclaimedon></policyclaimedon> <policyclaimtype></policyclaimtype> <policyclaimantname></policyclaimantname> </policyclaim> </policyclaimdetails> <policycomplaintdetails> <policycomplaint complaintid=""> <policycomplaintstatus></policycomplaintstatus> <policycomplainton></policycomplainton> </policycomplaint> </policycomplaintdetails> <billingdetails> <billing billingid=""> <billingamount></billingamount> <billingmode></billingmode> </billing> </billingdetails> </policy> </polcydetails> </customerinformation>
i have created view on above structure. have created single view elements, on tableau got duplicate values cartesian join result. tackle this, used approach of fragment root. since there can multiple policydetails single customer. have created fragment root on policy. claims, complaints, billing, quote can multiple single policy, have created fragment root on each 1 of them.
now after doing resolves duplicate issue cartesian join result set. gives unique set of record each entities (customerinfo, policy, claims, complaints, quote, employer, billing).
however not able relate entities each other (as in foreign-primary key).
i have created following view element scope , all. pasting customer , policy details, if resolves other entities can managed
view:create( "insurancepoc", "customerbasicinfo", view:element-view-scope(xs:qname("customerinformation")), ( view:column("customerid", cts:element-attribute-reference(xs:qname("customerinformation"), xs:qname("customerid"))), view:column("policyid", cts:element-attribute-reference(xs:qname("policy"), xs:qname("policyid"))), view:column("quotenumber", cts:element-attribute-reference(xs:qname("quote"), xs:qname("quotenumber"))), view:column("complaintid", cts:element-attribute-reference(xs:qname("policycomplaint"), xs:qname("complaintid"))), view:column("billingid", cts:element-attribute-reference(xs:qname("billing"), xs:qname("billingid"))),:) view:column("customerfirstname", cts:element-reference(xs:qname("customerfirstname"))), view:column("customerlastname", cts:element-reference(xs:qname("customerlastname"))) ), (), () ), view:create( "insurancepoc", "polcyinfo", view:element-view-scope(xs:qname("policy")), ( view:column("policyid", cts:element-attribute-reference(xs:qname("policy"), xs:qname("policyid"))), view:column("policyname", cts:element-reference(xs:qname("policyname"))), view:column("policytype", cts:element-reference(xs:qname("policytype"))) ), (), () )
all pre-requisites element-range index , been done.
i trying relate these entities using view:column("policyid", cts:element-attribute-reference(xs:qname("policy"), xs:qname("policyid")))
in customerbasicinfo view
.
if shows 0 results in tableau or query console. if remove it, gives unique record without relationship each other. want achieve relationship between policy-customer
kindly go through code snippet, if more clarification required please let me know
Comments
Post a Comment