Tuesday, January 28, 2020

How to iterate from detail block to sub detail block

    public void assetApprove(String transapprv) {
        //asset apprroval
        try {
            ViewObject voDtl = ReusableMethodsClass.getViewObjectByIteratorName("FaTransDtlVO1Iterator");
            Row[] rsid = voDtl.getAllRowsInRange();
                if (rsid != null) {
                    Row rIn1 = null;
                    int schRowCnt = voDtl.getRowCount();
                    int tmp2 = 0;
                    while (tmp2 < schRowCnt) {
                        //for(int j = 0;j< rIn.length;j++){
                        if (tmp2 == 0)
                            rIn1 = voDtl.first();
                        else
                            rIn1 = voDtl.next();
                       
                        System.out.println("MainacCodeDtl: " +rIn1.getAttribute("MainacCodeDtl"));
                        assetTransApproved(transapprv);
                        tmp2++; 
                    }
                }
             
        } catch (NullPointerException npe) {
            CommonCode.showExceptionMessage(npe);
        } catch (Exception e) {
            CommonCode.showExceptionMessage(e);
        }
    }
   
    public void assetTransApproved(String transApprv){
        ViewObject voAsset = ReusableMethodsClass.getViewObjectByIteratorName("FaAssetMstVO1Iterator");
        if(voAsset!=null){
            Row ra = voAsset.first();
            for(int j = 0; j < voAsset.getRowCount(); j++){
                System.out.println("AssetCode "+ra.getAttribute("AssetCode"));
                ra.setAttribute("TransApproved", transApprv);
                ra = voAsset.next(); 
            }
        }
    }