4

3 つのエンティティの属性を表示するビューが必要です。
統計にはアカウントへのルックアップがあり、アカウントにはアドレスへのルックアップがあります。

ビューは統計にあり、3 つのエンティティすべての属性が必要です。これは可能ですか?

問題は GridXML にあります。
GridXML に属性 wl_city を含めたいと考えています。

これは、リンク エンティティを含む FetchXML です。

<fetchxml>
  <fetch version="1.0" output-format="xml-platform" mapping="logical">
    <entity name="sb_statistics">
      <order attribute="sb_amount" descending="false" />
      <!-- It is easy to get these into the GridXML -->
      <attribute name="sb_debtor" />
      <attribute name="sb_date" />
      <attribute name="sb_amount" />
      <link-entity name="account" from="accountid" to="sb_debtor" 
       alias="relatedAccount" link-type="outer">
        <!-- It is possible to get this into the GridXML
             by using the link-entity alias: relatedAccount.wl_towncity -->
        <attribute name="wl_towncity" />
        <link-entity name="wl_postalcode" from="wl_postalcodeid" 
          to="wl_postaltowncity" alias="relatedAddress" link-type="outer">
          <!-- I have trouble getting this attribute into the GridXML -->
          <attribute name="wl_city" />
        </link-entity>
      </link-entity>
      <attribute name="sb_statisticsid" />
    </entity>
  </fetch>
</fetchxml>

以下のように GridXML を変更すると、ビューを開いたときに次のエラーが表示さ
れます。

  <layoutxml>
    <grid name="resultset" object="10008" jump="sb_name" select="1" preview="1" 
     icon="1">
      <row name="result" id="sb_statisticsid" multiobjectidfield="1">
        <cell name="sb_amount" width="100" />
        <cell name="sb_date" width="100" />
        <cell name="sb_debtor" width="100" />
        <cell name="relatedAccount.relatedAddress.wl_city" width="100" />
      </row>
    </grid>
  </layoutxml>

以下の GridXML は、ビューを開いたときにこのエラーを示しています:
予期しないエラーエラーが発生しました」。

  <layoutxml>
    <grid name="resultset" object="10008" jump="sb_name" select="1" preview="1" 
     icon="1">
      <row name="result" id="sb_statisticsid" multiobjectidfield="1">
        <cell name="sb_amount" width="100" />
        <cell name="sb_date" width="100" />
        <cell name="sb_debtor" width="100" />
        <cell name="relatedAddress.wl_city" width="100" />
      </row>
    </grid>
  </layoutxml>

以下の GridXML では、ビューを開いたときに次のエラーが表示され
ます。

  <layoutxml>
    <grid name="resultset" object="10008" jump="sb_name" select="1" preview="1" 
     icon="1">
      <row name="result" id="sb_statisticsid" multiobjectidfield="1">
        <cell name="sb_amount" width="100" />
        <cell name="sb_date" width="100" />
        <cell name="sb_debtor" width="100" />
        <cell name="wl_city" width="100" />
      </row>
    </grid>
  </layoutxml>

この保存されたクエリは機能しますが、プライマリ エンティティと最初のリンク エンティティの属性のみが含まれます。

<savedquery>
  <IsCustomizable>1</IsCustomizable>
  <CanBeDeleted>0</CanBeDeleted>
  <isquickfindquery>0</isquickfindquery>
  <isprivate>0</isprivate>
  <isdefault>0</isdefault>
  <returnedtypecode>10008</returnedtypecode>
  <savedqueryid>{df101ac4-2e4d-e311-9377-005056bd0001}</savedqueryid>
  <layoutxml>
    <grid name="resultset" object="10008" jump="sb_name" select="1" preview="1" 
     icon="1">
      <row name="result" id="sb_statisticsid" multiobjectidfield="1">
        <cell name="sb_amount" width="100" />
        <cell name="sb_date" width="100" />
        <cell name="sb_debtor" width="100" />  
        <cell name="relatedAccount.wl_city" width="100" />              
      </row>
    </grid>
  </layoutxml>
  <querytype>0</querytype>
  <fetchxml>
    <fetch version="1.0" output-format="xml-platform" mapping="logical">
      <entity name="sb_statistics">
        <order attribute="sb_amount" descending="false" />
        <attribute name="sb_debtor" />
        <attribute name="sb_date" />
        <attribute name="sb_amount" />
        <link-entity name="account" from="accountid" to="sb_debtor" 
         alias="relatedAccount" link-type="outer">
          <attribute name="wl_towncity" />
          <link-entity name="wl_postalcode" from="wl_postalcodeid" 
           to="wl_postaltowncity" alias="relatedAddress" link-type="outer">
            <attribute name="wl_city" />
          </link-entity>
        </link-entity>
        <attribute name="sb_statisticsid" />
      </entity>
    </fetch>
  </fetchxml>
  <LocalizedNames>
    <LocalizedName description="Statistics and Address" languagecode="1033" />
  </LocalizedNames>
</savedquery> 

GridXML は、プライマリ エンティティと最初のリンク エンティティの属性のみを表示するように制限されていますか?

4

5 に答える 5

2

ネストされたリンクに link-type="inner" を使用すると機能するはずです。

<entity name="sb_statistics">
    ...
    <link-entity name="account" from="accountid" to="sb_debtor" 
     alias="relatedAccount" link-type="outer">
      <attribute name="wl_towncity" />
      <link-entity name="wl_postalcode" from="wl_postalcodeid" 
       to="wl_postaltowncity" alias="relatedAddress" link-type="inner"> //link-type="inner"
        <attribute name="wl_city" />
      </link-entity>
    </link-entity>
    <attribute name="sb_statisticsid" />
  </entity>
于 2016-04-04T14:20:08.630 に答える
0

この質問に答えるのは少し遅いと思いますが、誰かがこの投稿に来て、役に立つと思うかもしれません.

最初に知っておくべきことは、fetchxml は null ではない列のみを返すことです。そのため、データのない列をクエリしている場合、fetchxml は自動的に結果セットから削除します。

2 つ目は、関係が異なる別のテーブルがある場合、エイリアス名が列名に追加されるため、この場合relatedAccount.wl_towncity、 andrelatedAddress.wl_cityは正しく、 ではありませんrelatedAccount.relatedAddress.wl_city。あなたの例では、正しくないエイリアス名を次々に付けています。

3 番目に知っておくべきことは、入れ子になった結果が返される場合、型は object ですが、元の typeAliasedValueであるため、最初に object を にキャストする必要があるということAliasedValueです。にキャストする準備が整いOptionSetValueます。.Valueその後、あなたが望む結果を持っているものを探す必要があります

于 2015-01-06T13:37:07.203 に答える