OSGI HengSin/File2PackZip

From ADempiere
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.
Any window table has export function..
..that exports to 2Pack besides Excel formats!
A choice of single record or all records!

Data Portability On Demand

  • I think we have found our holy grail of data agility in ERP.
  • Imagine able to export out any table in the window you are at for another person on another system with easy clicks.
  • Imagine able to go to another remote ADempiere instance and put back your table without an import loader!
  • Imagine keeping your data truly backup without dependence on the Database been there!
  • Imagine having your backup tables portable and readable as an XML or Excel formats at the same time!
  • Imagine not worrying about Foreign Key IDs conflicting as tables from different instances are merged into each other! (thanks to OSGI HengSin/UUID Generator)
  • This is a very convenient tool in any window. Just by selecting File > Export, you can export all the records of the Window you are looking at.
  • You have a choice to export as an Excel or 2Pack format.
  • You can export the single record in focus or all the records in the window.
  • You can select the target directory to save the file in and give it a unique name for easy managing later.
  • All this is tested on the latest OSGI HengSin codebase.

PackOut.xml

  • Following is a sample output of a single record i exported from my just PackIn Flight Schedule Module.
<?xml version="1.0" encoding="ISO-8859-1"?>
<adempiereAD Name="IS_Schedule" Version="1.0.0" AdempiereVersion="Release 3.6.0LTS @ 
2010-06-14" DataBaseVersion="2010-06-14" Description="" Author="SuperUser" 
AuthorEmail="" CreatedDate="Tue Dec 28 16:13:04 MYT 2010" UpdatedDate="Tue Dec 28 
16:13:04 MYT 2010" PackOutVersion="100" Client="11-GardenWorld-GardenWorld">
    <IS_Schedule type="table">
        <AD_Org_ID>@AD_Org_ID@</AD_Org_ID>
        <Description>AK1010</Description>
        <Destination>KLI</Destination>
        <Details>BangkokKuL</Details>
        <IS_Schedule_UU>29b03832-499d-4ea5-9337-be9ba812fea0</IS_Schedule_UU>
        <IsActive>true</IsActive>
        <Name>AK101</Name>
        <Origin>BKK</Origin>
        <Value>1000000</Value>
    </IS_Schedule>
</adempiereAD>

What about a Master-Detail window?

  • Can this work for whole window with multi-tabs such as Business Partner Window or let's say a Sales Order that has OrderLines?
  • The answer is YES! See the PackOut.xml extract for a Sales Order below:
...
            <PriceList>22.73</PriceList>
            <Processed>true</Processed>
            <QtyAllocated>0</QtyAllocated>
            <QtyDelivered>10</QtyDelivered>
            <QtyEntered>10</QtyEntered>
            <QtyInvoiced>10</QtyInvoiced>
            <QtyLostSales>0</QtyLostSales>
            <QtyOrdered>10</QtyOrdered>
            <QtyReserved>0</QtyReserved>
            <RRAmt/>
            <RRStartDate/>
            <Ref_OrderLine_ID reference="id"/>
            <S_ResourceAssignment_ID/>
            <User1_ID reference="id"/>
            <User2_ID reference="id"/>
        </C_OrderLine>
        <C_OrderTax>
            <AD_Org_ID>@AD_Org_ID@</AD_Org_ID>
            <C_OrderTax_UU>11bd9ac1-70db-4018-ac5c-9feec2b135ef</C_OrderTax_UU>
            <C_Order_ID reference="id">108</C_Order_ID>
            <C_Tax_ID reference="id">105</C_Tax_ID>
            <IsActive>true</IsActive>
            <IsTaxIncluded>false</IsTaxIncluded>
            <Processed>true</Processed>
            <TaxAmt>12.95</TaxAmt>
            <TaxBaseAmt>215.9</TaxBaseAmt>
        </C_OrderTax>
    </C_Order>
    <C_Order type="table">
        <AD_Org_ID>@AD_Org_ID@</AD_Org_ID>
        <AD_OrgTrx_ID reference="id"/>
        <AD_User_ID reference="id"/>
        <AmountRefunded/>
        <AmountTendered/>
        <Bill_BPartner_ID reference="id">112</Bill_BPartner_ID>
        <Bill_Location_ID reference="id">108</Bill_Location_ID>
        <Bill_User_ID reference="id"/>
...
  • Note the existence of 3 tabs within the xml tags.

Exporting As Excel

  • This option is an earlier separate contribution from Teo Sarca, Romania.
  • When you select the File Save As > Type as Excel you can click on X so as to get all records.
  • But the Export only export the current record backwards. So you need to be at the last record to get all. See results below:
Excel format export for Business Partner window main tab. Go to the last record and decline single record choice.

Developer's Note

  • The manner in which the 2Pack can do this magic is due to the ElementHandlers. You can modify or extend its functionality further to do say export out associated objects to the main object you are packing out.
  • For example, at the moment, Packout of table information does not include Rule objects stated in the Callout fields.
  • You can thus modify the ColumnElementHandler to do that.