XML DataSource SourceType="SQL"
Tags: uyumsoft
Published: 2022-10-03 19:08:17

> Örnek
```
<tabpage Caption="Kaynak İzle">
<section Caption="Teklifler" CaptionVisibility="True" Visibility="True">
<row>
<cell colspan="1">
<control FieldName="Grid1" ControlType="GridEdit" Caption="Teklifler" HorizontalScrollBarMode="Hidden" ServerAttribute="KeyFieldName=OFFER_M_ID">
<DataSource SourceType="SQL" Source="
SELECT
OFM.OFFER_M_ID,
OFD.OFFER_D_ID,
TO_CHAR(OFM.DOC_DATE,'DD.MM.YYYY') AS TEKLIF_TARIH,
OFM.DOC_NO AS TEKLIF_NO,
ITE.DCARD_CODE AS STOK_KOD,
ITE.DCARD_NAME AS STOK_AD,
OFD.QTY AS MIKTAR,
OFD.AMT_WITH_DISC_TRA / OFD.QTY AS BIRIM_FIYAT

FROM PSMT_OFFER_M OFM
LEFT JOIN PSMT_OFFER_D OFD ON OFM.OFFER_M_ID = OFD.OFFER_M_ID
LEFT JOIN INVW_ITEM_TABLES ITE ON OFD.DCARD_ID = ITE.DCARD_ID
WHERE
1=1
AND OFD.OFFER_M_ID IN (SELECT ORD.SOURCE_M_ID FROM PSMT_ORDER_D ORD WHERE ORD.ORDER_M_ID = {Id})"/>
<GridColumn FieldName="TEKLIF_TARIH" ControlType="DateEdit" Caption="Teklif Tarih" Width="45"> </GridColumn>
<GridColumn FieldName="TEKLIF_NO" ControlType="TextEdit" Caption="Teklif No" Width="45"> </GridColumn>
<GridColumn FieldName="STOK_KOD" ControlType="TextEdit" Caption="Stok Kod" Width="75"> </GridColumn>
<GridColumn FieldName="STOK_AD" ControlType="TextEdit" Caption="Stok Ad" Width="250"> </GridColumn>
<GridColumn FieldName="MIKTAR" ControlType="SpinEdit" Caption="Miktar" Width="45"> </GridColumn>
<GridColumn FieldName="BIRIM_FIYAT" ControlType="SpinEdit" Caption="Birim Fiyat" Width="45"> </GridColumn>
</control>
</cell>
</row>
</section>

<section Caption="Talepler" CaptionVisibility="True" Visibility="True">
<row>
<cell colspan="1">
<control FieldName="Grid2" ControlType="GridEdit" Caption="Talepler" HorizontalScrollBarMode="Hidden" ServerAttribute="KeyFieldName=REQUEST_M_ID">
<MasterGrid MasterProperty="Grid1" MasterKey="OFFER_M_ID" DetailKey="OFFER_M_ID" />
<DataSource  SourceType="SQL" Source="
SELECT
concat('GeneralCard.aspx?CommandName=RequestMCollection.Analyze&amp;ObjectId=',RQM.REQUEST_M_ID) AS URL,
TO_CHAR(RQM.DOC_DATE,'DD.MM.YYYY') AS TALEP_TARIH,
RQM.DOC_NO AS TALEP_NO,
REG.REGISTER_FULL_NAME AS PERSONEL,
ITE.DCARD_CODE AS STOK_KOD,
ITE.DCARD_NAME AS STOK_AD,
RQD.QTY AS MIKTAR,
RQD.NOTE1 AS ACIKLAMA1,
RQD.NOTE2 AS ACIKLAMA2,
RQD.NOTE3 AS ACIKLAMA3,
RQD.NOTE_LARGE AS NOT1
                    
FROM PSMT_REQUEST_M RQM
LEFT JOIN PSMT_REQUEST_D RQD ON RQM.REQUEST_M_ID = RQD.REQUEST_M_ID
LEFT JOIN INVW_ITEM_TABLES ITE ON RQD.DCARD_ID = ITE.DCARD_ID
LEFT JOIN HRMD_REGISTER REG ON RQD.REGISTER_ID = REG.REGISTER_ID
WHERE
1=1
AND RQD.REQUEST_D_ID IN (SELECT OFD.SOURCE_D_ID FROM PSMT_OFFER_D OFD WHERE OFD.OFFER_M_ID ={Grid1.OFFER_M_ID} AND OFD.OFFER_D_ID={Grid1.OFFER_D_ID})"/>
<GridColumn FieldName="TALEP_TARIH" ControlType="TextEdit" Caption="Talep Tarih" Width="50"></GridColumn>
<GridColumn FieldName="URL" ControlType="LinkEdit" TextField="TALEP_NO" Caption="Talep No" Width="50" NavigateUrlFormatString="{0}"  ServerAttribute="PropertiesHyperLinkEdit-Target=_blank"></GridColumn>
<GridColumn FieldName="PERSONEL" ControlType="TextEdit" Caption="Personel"  Width="50"></GridColumn>
<GridColumn FieldName="STOK_KOD" ControlType="TextEdit" Caption="Stok Kod"  Width="75"></GridColumn>
<GridColumn FieldName="STOK_AD" ControlType="TextEdit" Caption="Stok Ad"  Width="250"></GridColumn>
<GridColumn FieldName="MIKTAR" ControlType="SpinEdit" Caption="Miktar"  Width="50"></GridColumn>
<GridColumn FieldName="ACIKLAMA1" ControlType="TextEdit" Caption="Açıklama1"  Width="50"></GridColumn>
<GridColumn FieldName="ACIKLAMA2" ControlType="TextEdit" Caption="Açıklama2"  Width="50"></GridColumn>
<GridColumn FieldName="ACIKLAMA3" ControlType="TextEdit" Caption="Açıklama3"  Width="50"></GridColumn>
<GridColumn FieldName="NOT1" ControlType="TextEdit" Caption="Not"  Width="50"></GridColumn>
<GridColumn FieldName="NOT1" ControlType="TextEdit" Caption="Not"  Width="50"></GridColumn>
</control>

<control FieldName="btnDbSave" ControlType="Button" Caption="Ara" Width="100">
<ClientSideEvents Click="function (s,e) {GetControl('TownList').PerformCallback('Refresh')} "> </ClientSideEvents>
</control>


</cell>
</row>
</section>

</tabpage>
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w0hhyc8i3t64belyveg2.png)

> tabpage, sql results, SourceType SQL
```
<tabpage Caption="Ambalaj İzle">
<section Caption="Ambalaj" CaptionVisibility="True" Visibility="True">
<row>
<cell colspan="1">
<control FieldName="Grid1" ControlType="GridEdit" Caption="Ambalaj" HorizontalScrollBarMode="Hidden" ServerAttribute="KeyFieldName=ITEM_M_ID">
<DataSource SourceType="SQL" Source="
SELECT
concat('GeneralCard.aspx?CommandName=PackageMCollection.Analyze&amp;ObjectId=',IPM.PACKAGE_ID) AS URL,
IPM.PACKAGE_NO AS PALET_NO,
WHO.WHOUSE_CODE AS DEPO_KOD,
ITE.ITEM_CODE AS STOK_KOD,
ITE.ITEM_NAME AS STOK_AD,
LOT.LOT_CODE AS PARTI,
A01.ITEM_ATTRIBUTE_CODE AS OZELLIK1,
WHL.LOCATION_CODE AS RAF,
ROUND(IPM.QTY,2) AS PALET_ICI_MIKTAR,
ROUND(IPM.QTY * ITE.NET_WEIGHT,2) AS AGIRLIK_KG
FROM INVD_PACKAGE_M IPM
LEFT JOIN INVD_ITEM ITE ON IPM.ITEM_ID = ITE.ITEM_ID
LEFT JOIN INVD_WHOUSE WHO ON IPM.WHOUSE_ID = WHO.WHOUSE_ID
LEFT JOIN INVD_LOT LOT ON IPM.LOT_ID = LOT.LOT_ID
LEFT JOIN INVD_ITEM_ATTRIBUTE A01 ON IPM.ITEM_ATTRIBUTE1_ID = A01.ITEM_ATTRIBUTE_ID
LEFT JOIN INVD_BWH_LOCATION WHL ON IPM.BWH_LOCATION_ID = WHL.BWH_LOCATION_ID 
WHERE
1=1
AND IPM.INPUT_OUTPUT = 1
AND IPM.WORDER_M_ID = {Id}"/>
<GridColumn FieldName="URL" ControlType="LinkEdit" TextField="PALET_NO" Caption="Palet No" Width="50" NavigateUrlFormatString="{0}"  ServerAttribute="PropertiesHyperLinkEdit-Target=_blank"></GridColumn>
<GridColumn FieldName="DEPO_KOD" ControlType="TextEdit" Caption="Depo Kod" Width="45"> </GridColumn>
<GridColumn FieldName="STOK_KOD" ControlType="TextEdit" Caption="Stok Kod" Width="75"> </GridColumn>
<GridColumn FieldName="STOK_AD" ControlType="TextEdit" Caption="Stok Ad" Width="250"> </GridColumn>
<GridColumn FieldName="PARTI" ControlType="TextEdit" Caption="Parti" Width="250"> </GridColumn>
<GridColumn FieldName="OZELLIK1" ControlType="TextEdit" Caption="Özellik-1" Width="250"> </GridColumn>
<GridColumn FieldName="RAF" ControlType="TextEdit" Caption="Raf" Width="250"> </GridColumn>
<GridColumn FieldName="PALET_ICI_MIKTAR" ControlType="SpinEdit" Caption="Palet içi Miktar" Width="45"> </GridColumn>
<GridColumn FieldName="AGIRLIK_KG" ControlType="SpinEdit" Caption="Ağırlık" Width="45"> </GridColumn>
</control>
</cell>
</row>
</section>
</tabpage>
```


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/03czofr5nx6uddsbzr0q.png)

> Master Detay

```
<tabpage Caption="Kaynak İzle">
<section Caption="Teklifler" CaptionVisibility="True" Visibility="True">
<row>
<cell colspan="1">
<control FieldName="Grid1" ControlType="GridEdit" Caption="Teklifler" HorizontalScrollBarMode="Hidden" ServerAttribute="KeyFieldName=OFFER_M_ID">
<DataSource SourceType="SQL" Source="
SELECT
OFM.OFFER_M_ID,
OFD.OFFER_D_ID,
TO_CHAR(OFM.DOC_DATE,'DD.MM.YYYY') AS TEKLIF_TARIH,
OFM.DOC_NO AS TEKLIF_NO,
ITE.DCARD_CODE AS STOK_KOD,
ITE.DCARD_NAME AS STOK_AD,
OFD.QTY AS MIKTAR,
OFD.AMT_WITH_DISC_TRA / OFD.QTY AS BIRIM_FIYAT

FROM PSMT_OFFER_M OFM
LEFT JOIN PSMT_OFFER_D OFD ON OFM.OFFER_M_ID = OFD.OFFER_M_ID
LEFT JOIN INVW_ITEM_TABLES ITE ON OFD.DCARD_ID = ITE.DCARD_ID
WHERE
1=1
AND OFD.OFFER_M_ID IN (SELECT ORD.SOURCE_M_ID FROM PSMT_ORDER_D ORD WHERE ORD.ORDER_M_ID = {Id})"/>
<GridColumn FieldName="TEKLIF_TARIH" ControlType="DateEdit" Caption="Teklif Tarih" Width="45"> </GridColumn>
<GridColumn FieldName="TEKLIF_NO" ControlType="TextEdit" Caption="Teklif No" Width="45"> </GridColumn>
<GridColumn FieldName="STOK_KOD" ControlType="TextEdit" Caption="Stok Kod" Width="75"> </GridColumn>
<GridColumn FieldName="STOK_AD" ControlType="TextEdit" Caption="Stok Ad" Width="250"> </GridColumn>
<GridColumn FieldName="MIKTAR" ControlType="SpinEdit" Caption="Miktar" Width="45"> </GridColumn>
<GridColumn FieldName="BIRIM_FIYAT" ControlType="SpinEdit" Caption="Birim Fiyat" Width="45"> </GridColumn>
</control>
</cell>
</row>
</section>

<section Caption="Talepler" CaptionVisibility="True" Visibility="True">
<row>
<cell colspan="1">
<control FieldName="Grid2" ControlType="GridEdit" Caption="Talepler" HorizontalScrollBarMode="Hidden" ServerAttribute="KeyFieldName=REQUEST_M_ID">
<MasterGrid MasterProperty="Grid1" MasterKey="OFFER_M_ID" DetailKey="OFFER_M_ID" />
<DataSource  SourceType="SQL" Source="
SELECT
concat('GeneralCard.aspx?CommandName=RequestMCollection.Analyze&amp;ObjectId=',RQM.REQUEST_M_ID) AS URL,
TO_CHAR(RQM.DOC_DATE,'DD.MM.YYYY') AS TALEP_TARIH,
RQM.DOC_NO AS TALEP_NO,
REG.REGISTER_FULL_NAME AS PERSONEL,
ITE.DCARD_CODE AS STOK_KOD,
ITE.DCARD_NAME AS STOK_AD,
RQD.QTY AS MIKTAR,
RQD.NOTE1 AS ACIKLAMA1,
RQD.NOTE2 AS ACIKLAMA2,
RQD.NOTE3 AS ACIKLAMA3,
RQD.NOTE_LARGE AS NOT1
                    
FROM PSMT_REQUEST_M RQM
LEFT JOIN PSMT_REQUEST_D RQD ON RQM.REQUEST_M_ID = RQD.REQUEST_M_ID
LEFT JOIN INVW_ITEM_TABLES ITE ON RQD.DCARD_ID = ITE.DCARD_ID
LEFT JOIN HRMD_REGISTER REG ON RQD.REGISTER_ID = REG.REGISTER_ID
WHERE
1=1
AND RQD.REQUEST_D_ID IN (SELECT OFD.SOURCE_D_ID FROM PSMT_OFFER_D OFD WHERE OFD.OFFER_M_ID ={Grid1.OFFER_M_ID} AND OFD.OFFER_D_ID={Grid1.OFFER_D_ID})"/>
<GridColumn FieldName="TALEP_TARIH" ControlType="TextEdit" Caption="Talep Tarih" Width="50"></GridColumn>
<GridColumn FieldName="URL" ControlType="LinkEdit" TextField="TALEP_NO" Caption="Talep No" Width="50" NavigateUrlFormatString="{0}"  ServerAttribute="PropertiesHyperLinkEdit-Target=_blank"></GridColumn>
<GridColumn FieldName="PERSONEL" ControlType="TextEdit" Caption="Personel"  Width="50"></GridColumn>
<GridColumn FieldName="STOK_KOD" ControlType="TextEdit" Caption="Stok Kod"  Width="75"></GridColumn>
<GridColumn FieldName="STOK_AD" ControlType="TextEdit" Caption="Stok Ad"  Width="250"></GridColumn>
<GridColumn FieldName="MIKTAR" ControlType="SpinEdit" Caption="Miktar"  Width="50"></GridColumn>
<GridColumn FieldName="ACIKLAMA1" ControlType="TextEdit" Caption="Açıklama1"  Width="50"></GridColumn>
<GridColumn FieldName="ACIKLAMA2" ControlType="TextEdit" Caption="Açıklama2"  Width="50"></GridColumn>
<GridColumn FieldName="ACIKLAMA3" ControlType="TextEdit" Caption="Açıklama3"  Width="50"></GridColumn>
<GridColumn FieldName="NOT1" ControlType="TextEdit" Caption="Not"  Width="50"></GridColumn>
<GridColumn FieldName="NOT1" ControlType="TextEdit" Caption="Not"  Width="50"></GridColumn>
</control>

<control FieldName="btnDbSave" ControlType="Button" Caption="Ara" Width="100">
<ClientSideEvents Click="function (s,e) {GetControl('TownList').PerformCallback('Refresh')} "> </ClientSideEvents>
</control>


</cell>
</row>
</section>

</tabpage>
```