Friday, 19 May 2017

Dynamics AX 2012 Multiple join on same table using QueryBuildDataSource (qbds)



Multiple join on same table using QueryBuildDataSource (qbds) Dynamics AX 2012
Once I come across the situation where there I have to build query using QueryBuildDataSource(qbds) with multiple tables and even same table with multiple join. By the simple joins it populate wrong data output (multiple row for each single row in main table).

So below is the example how to achieve the proper output having multiple join on same table using qbds in Microsoft dynamics ax 2012

QueryBuildDataSource qbdsInventJournalTable,qbdsInventJournalTrans,qbdsInventdim,qbdsInventdim1;

   QueryRun    qr;
   Query       q;
   InventJournalTrans  ObjInventJournalTrans;
   InventDim           ObjInventDim,ObjInventDim1;
   
   
   q= new Query();

   qbdsInventJournalTable = q.addDataSource(tableNum(InventJournalTable));
   
   qbdsInventJournalTrans = qbdsInventJournalTable.addDataSource(tableNum(InventJournalTrans));
   qbdsInventJournalTrans.relations(true);
   
   qbdsInventdim = qbdsInventJournalTrans.addDataSource(tablenum(Inventdim));
   qbdsInventdim.joinMode(JoinMode::InnerJoin);
   qbdsInventdim.addLink(fieldNum(Inventdim,InventDimId),fieldNum(InventJournalTrans,InventDimId));
   qbdsInventdim.fetchMode(QueryFetchMode::One2One);

   qbdsInventdim1 = qbdsInventJournalTrans.addDataSource(tablenum(Inventdim));
   qbdsInventdim1.joinMode(JoinMode::InnerJoin);
   qbdsInventdim1.addLink(fieldNum(Inventdim,InventDimId),fieldNum(InventJournalTrans,ToInventDimId));
   qbdsInventdim1.fetchMode(QueryFetchMode::One2One);

   qr = new QueryRun(q);

   while(qr.next())
   {
       ObjInventJournalTrans = qr.get(tableNum(InventJournalTrans));
       ObjInventDim = qr.get(tableNum(InventDim),1);
       ObjInventDim1 = qr.get(tableNum(InventDim),2);
// code to insert on table
   }

Saturday, 18 March 2017

Compare PPF, FD and NSC


Compare PPF, FD and NSC



Public Provident Fund, Fixed Deposit and National Saving Certificates


 


As an individual, I search for investment options for tax saving for financial year.

I have questions.
Where do I invest so that I can save my tax maximum PPF, FD , NSC, ELSS etc..?
Which are the best options?
Which options are safe?
Which option give more returns? Which option give different facilities like loan or withdrawal?
So here, I collect some information on PPF, FD and NSC
PPF
FD
NSC
PPF (Public Provident Fund) is a saving-cum-tax saving scheme
Fixed Deposit is Term Deposit. The interest rate is fixed for the whole maturity period
National Saving Certificate
Interest rate
7.9% per annum
6 to 7 % per annum (varies by bank)
NSC IX 8.1%
Lock in period
15 Years
5 years (tax benefit)
5 year 
Min & Max
Min 500 and Max 1.5 Lakhs
any amount
Min 100 and Max no limit
Taxable benefit
fully tax exempt under sec 80C
tax exempt under sec 80C
tax exempt under sec 80C
Interest earned
Tax-free
Taxable
Taxable
Withdrawal
from 7th financial year
No
No
Loan
Yes, Between 3rd to 5th Year. 25% of total balance of preceding year
Yes
Yes, from any bank
Loan interest rate
2% higher than deposits
1% or 2%