web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

The Value"" is not found in the map

(0) ShareShare
ReportReport
Posted on by 3,110

Dear Experts,

while running Report i developed and running from the form getting this error.?

ssrsError.png

Best Regards,

Shabir Ahmad

I have the same question (0)
  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    Please use the debugger to find where the error is thrown.

    We can't identify the bug in your code because we've never seen your code.

  • Shabir Ahmad Profile Picture
    3,110 on at

    Controller class
    
    class SA_SalesEthenRadController extends SrsReportRunController
    
    {
    
    public static void main(Args    _args)
    
    {
    
       SA_SalesEthenRadController     controller = new SA_SalesEthenRadController();
    
           if(_args.menuItemName() == menuitemOutputStr(SA_ReturnAcknowledgment_ActionCopy))
    
           controller.parmReportName(ssrsReportStr(SA_ReturnAcknowledgmentAndDocumentCopy, Report));
    
       //else if(_args.menuItemName() == menuitemOutputStr(DF_SalesTallabRad))
    
       //controller.parmReportName(ssrsReportStr(DF_SalesEthenRad, ReportC1));
    
       //else if(_args.menuItemName() == menuitemOutputStr(DF_ReturnTallabRadDamage))
    
      // else if(_args.menuItemName() == menuitemOutputStr(DF_SalesReturnCustomer_020))
    
        //   controller.parmReportName(ssrsReportStr(DF_SalesReturnNewReports6, Report_S_020)); **/
    
       controller.parmArgs(_args);
    
       controller.parmShowDialog(false);
    
       controller.startOperation();
    
    }
    
    }
    
    Contract Class
    
    [DataContractAttribute]
    
    public class SA_SalesEthenRadContract
    
    {
    
       SalesId         salesId;
    
       ReturnItemNum   returnNum;
    
       [DataMemberAttribute("returnNum")]
    
       public ReturnItemNum parmReturnItemNum(ReturnItemNum  _returnNum = returnNum)
    
       {
    
           returnNum = _returnNum;
    
           return returnNum;
    
       }
    
       [DataMemberAttribute("salesId")]
    
       public SalesId parmSalesId(SalesId  _salesId = salesId)
    
       {
    
           salesId = _salesId;
    
           return salesId;
    
       }
    
    }
    
    DP class
    
    /// 
    
    /// SALES ETHEN RAD REPORT, THIS REPORT IS RUN FROM ALL RETURN ORDER FORM.SALES AND MARKETING.
    
    /// 
    
    /// 
    
    /// 15-02-2020-YK, FUNCTIONAL CONSULTANT: MAHMOOD.
    
    /// 
    
    [SRSReportParameterAttribute(classStr(SA_SalesEthenRadContract))]
    
    class SA_SaleReturnDP extends SRSReportDataProviderBase
    
    {
    
      // SalesTransTalabHedTmp       salesTalabHedTmp;
    
       SA_SalebLineTmp           salesTableLineTmp;
    
     //  SalesTransTalabTotalTmp     salesTalabTotalTmp;
    
      // RepHeaderImagesTmp          repHeaderImagesTmp;
    
       SA_SalesEthenRadContract    contract;
    
       SalesId                     salesId;
    
       ReturnItemNum               returnItemNum;
    
       SalesTable                  salesTable, salesTable1;
    
       CustTable                   custTable;
    
       HcmWorker                   hcmWorker;
    
       CustInvoiceJour             custInvoiceJour,custInvoiceJour1;
    
       SalesLine                   salesLine;
    
       SalesTotals                 salesTotals;
    
       LogisticsElectronicAddress      logisticsElectronicAddress;
    
       // added
    
       real                            amount,totalSalesAmount;
    
       real                            netAmount;
    
       MarkupTrans                     markupTrans;
    
       MarkupTable                     markupTable;
    
       CustInvoiceTrans                custInvoiceTrans;
    
       TaxTable                        taxTable;
    
       TaxValue                        taxValue;
    
       TaxCode                         taxcode;
    
       TaxGroupData                    taxGroupData;
    
       TaxData                         taxData;
    
       str                             StrPercentage;
    
       TransDate                       myDate;
    
       container                       cont;
    
       TaxAmountCur                    taxAmountCur;
    
       real                            totOfOrder;
    
       DirPartyTable                   dirPartyTable;
    
       ContactPerson                   contactPerson;
    
       TransDate                               _transDate;
    
       DirPartyLocation                        dirPartyLocation;
    
       TaxRegistration                         taxRegistration;
    
       TaxRegistrationTypeApplicabilityRule    taxRegistrationTypeApplicabilityRule;
    
       //
    
       SalesLineTemp                   salesLineTemp;
    
       InventDim                       inventDim;
    
     //  Microsoft.Dynamics.QRCode.Encoder   qrCode;
    
       System.String                       netString;
    
       str                                 tempFileName;
    
       System.Drawing.Bitmap               netBitmap;
    
       Bitmap                              imageQR;
    
       FileIOPermission    perm;
    
       BinData             binData;
    
       container           imageContainer;
    
    /**
    
    [SRSReportDataSetAttribute("salesLineTemp")]
    
    public SalesLineTemp getSalesLineTemp()
    
    {
    
       select * from salesLineTemp;
    
       return salesLineTemp;
    
    }**/
    
    /**
    
    [SRSReportDataSetAttribute("salesTalabHedTmp")]
    
    public SalesTransTalabHedTmp getSalesTransTalabHedTmp()
    
    {
    
       select * from salesTalabHedTmp;
    
       return salesTalabHedTmp;
    
    }  **/
    
       [SRSReportDataSetAttribute("salesTableLineTmp")]
    
       public SA_SalebLineTmp getsalesTableLineTmpTmp()
    
    {
    
       select * from salesTableLineTmp;
    
           return salesTableLineTmp;
    
    }
    
    /**[SRSReportDataSetAttribute("salesTalabTotalTmp")]
    
    public SalesTransTalabTotalTmp getSalesTransTalabTotalTmp()
    
    {
    
       select * from salesTalabTotalTmp;
    
       return salesTalabTotalTmp;
    
    } **/
    
    public void processReport()
    
    {
    
       date currentDate;
    
       str s;
    
           contract = this.parmDataContract() as SA_SalesEthenRadContract;
    
           salesId  = contract.parmSalesId();
    
           returnItemNum = contract.parmReturnItemNum();
    
       //breakpoint;
    
       select firstOnly salesTable
    
           where salesTable.SalesId == salesId
    
           && salesTable.ReturnItemNum == returnItemNum;
    
       currentDate= salesTable.createDate();
    
       s = date2Str
    
           (currentDate,
    
           213,
    
           DateDay::Digits2,
    
           DateSeparator::Slash, // separator1
    
       DateMonth::Digits2,
    
           DateSeparator::Slash, // separator2
    
       DateYear::Digits4
    
           );
    
      /** salesTalabHedTmp.SalesId        = salesId;
    
       salesTalabHedTmp.CustAccountNum = salesTable.CustAccount;
    
       custTable = CustTable::find(salesTalabHedTmp.CustAccountNum);
    
       salesTalabHedTmp.ArabicName   = DirPartyTable::findRec(custTable.Party).Name;//ArabicName;
    
       salesTalabHedTmp.CustAddress  = DirParty::primaryPostalAddress(custTable.Party).Address;
    
       salesTalabHedTmp.CustPhone    = custTable.phone();
    
       salesTalabHedTmp.CustEmail    = custTable.email();
    
       /*select firstOnly logisticsElectronicAddress where logisticsElectronicAddress.PrivateForParty == custTable.Party && logisticsElectronicAddress.Type == LogisticsElectronicAddressMethodType::Phone ;
    
       salesTalabHedTmp.CustPhone = logisticsElectronicAddress.Locator;
    
       select firstOnly logisticsElectronicAddress1 where logisticsElectronicAddress1.PrivateForParty == custTable.Party && logisticsElectronicAddress1.Type == LogisticsElectronicAddressMethodType::Email;
    
       salesTalabHedTmp.CustEmail = logisticsElectronicAddress1.Locator;*/
    
       select firstOnly logisticsElectronicAddress where logisticsElectronicAddress.PrivateForParty == custTable.Party && logisticsElectronicAddress.Type == LogisticsElectronicAddressMethodType::Fax;
    
       salesTalabHedTmp.CustFax = logisticsElectronicAddress.Locator;
    
       salesTalabHedTmp.BatchId      = BatchTable::findRecId(salesTable.Batch).BatchId;
    
       salesTalabHedTmp.TransDate    = salesTable.createDate();
    
       hcmWorker = HcmWorker::find(salesTable.WorkerSalesResponsible);
    
       salesTalabHedTmp.SalesManName = hcmWorker.PersonnelNumber  " - " hcmWorker.name();
    
       salesTalabHedTmp.Warehouse    = InventLocation::find(salesTable.InventLocationId).Name;
    
       salesTalabHedTmp.Voucher      = salesTable.ReturnItemNum;
    
       salesTalabHedTmp.ReturnReason = ReturnReasonCode::find(salesTable.ReturnReasonCodeId).Description;
    
       if(salesTable.ReturnStatus == ReturnStatusHeader::Closed)
    
           salesTalabHedTmp.Posted     = "مرحل";
    
       else
    
           salesTalabHedTmp.Posted     = "غير مرحل";
    
          * */
    
       // Added aug 23 2020 by Shabir Ahmad
    
      /** select * from custInvoiceJour1 where custInvoiceJour1.SalesId == salesId;
    
       salesTalabHedTmp.Voucher2   = custInvoiceJour1.LedgerVoucher;
    
       salesTalabHedTmp.InvoiceId  = custInvoiceJour1.InvoiceId;  **/
    
       // Added aug 18 2020 by Shabir Ahmad
    
       _transDate = systemDateGet();
    
       if (_transDate)
    
       {
    
           dirPartyLocation = DirPartyLocation::findByPartyLocation(custTable.Party,
    
          custTable.invoiceAddress().Location);
    
           if (dirPartyLocation)
    
           {
    
               select firstonly validTimeState(_transDate) taxRegistration
    
            where taxRegistration.DirPartyLocation == dirPartyLocation.RecId
    
            join RecId from taxRegistrationTypeApplicabilityRule
    
              order by taxRegistrationTypeApplicabilityRule.IsPrimaryAddressRestricted desc
    
              where taxRegistration.TaxRegistrationTypeApplicabilityRule == taxRegistrationTypeApplicabilityRule.RecId;
    
           }
    
       }
    
     //  salesTalabHedTmp.CustomerRegNo    = taxRegistration.RegistrationNumber;
    
       // salesTalabHedTmp.insert();
    
       //LINES
    
       while select * from salesLine
    
           where salesLine.SalesId == salesTable.SalesId
    
       {
    
           salesTableLineTmp.clear();
    
               salesTableLineTmp.ItemId     = salesLine.ItemId;
    
               salesTableLineTmp.Description   = salesLine.itemName();
    
               salesTableLineTmp.Quantity   = salesLine.ExpectedRetQty;
    
               salesTableLineTmp.Unit  = salesLine.SalesUnit;
    
               salesTableLineTmp.Price = salesLine.SalesPrice;
    
               salesTableLineTmp.LineAmount = salesLine.LineAmount;
    
             // salesTableLineTmp.Site       = salesLine.inventDim().InventLocationId;
    
           totalSalesAmount = salesLine.LineAmount;
    
               salesTableLineTmp.insert();
    
       }
    
       while select * from salesLine
    
           where salesLine.SalesId == salesId
    
           && salesLine.CustAccount == salesTable.CustAccount
    
           && salesLine.SalesQty != 0
    
           outer join InventLocationId,InventSizeId,InventColorId,InventStyleId from inventDim
    
           where salesLine.InventDimId == inventDim.InventDimId
    
       {
    
           salesLineTemp.clear();
    
           salesLineTemp.DocumentNo       = salesLine.SalesId;
    
           salesLineTemp.ItemID           = salesLine.ItemId;
    
           salesLineTemp.ItemDescription  = salesLine.itemName();
    
           salesLineTemp.ItemColorID      = inventDim.InventColorId;
    
           salesLineTemp.ItemSalesUnit    = salesLine.SalesUnit;
    
           salesLineTemp.ItemSiteID       = inventDim.InventLocationId;
    
           salesLineTemp.ItemSizeID       = inventDim.InventSizeId;
    
           salesLineTemp.ItemStyleID      = inventDim.InventStyleId;
    
           salesLineTemp.SalesQty         = salesLine.SalesQty;
    
           salesLineTemp.ItemLineAmount   = salesLine.LineAmount;
    
           salesLineTemp.ItemLineDiscount = salesLine.LineDisc;
    
           salesLineTemp.ItemUnitCost     = salesLine.CostPrice;
    
           salesLineTemp.ItemUnitPrice    = salesLine.SalesPrice;
    
          // salesLineTemp.LineNum          = salesLine.LineNum;
    
           salesLineTemp.insert();
    
       }
    
    /**
    
       //END-LINES
    
       //HEADER IMAGE
    
       repHeaderImagesTmp.clear();
    
       repHeaderImagesTmp.HeaderLogo       = CompanyImage::findCustomImage(DFE_ImageType::SalesInvoice).Image;
    
       repHeaderImagesTmp.OrinatingUserId  = salesTable.createdBy;
    
       repHeaderImagesTmp.TransCreatedDate = salesTable.createdDateTime;
    
       repHeaderImagesTmp.CurrentUserId    = curUserId();
    
       repHeaderImagesTmp.Name             = ReturnReasonCode::find(salesTable.ReturnReasonCodeId).Description;
    
       repHeaderImagesTmp.insert();
    
       //LINE DETAILS
    
       if(salesTable.SalesStatus == SalesStatus::Invoiced)
    
       {
    
           select sum(InvoiceAmount),sum(SumTax),sum(EndDisc),sum(SumMarkup) from custInvoiceJour
    
               where custInvoiceJour.SalesId == salesId;
    
           salesTalabTotalTmp.clear();
    
           salesTalabTotalTmp.Vat        = custInvoiceJour.SumTax;
    
           salesTalabTotalTmp.SalesQty   = custInvoiceJour.Qty;
    
           salesTalabTotalTmp.Discount   = custInvoiceJour.EndDisc;
    
           salesTalabTotalTmp.SubTotal   = custInvoiceJour.SalesBalance;
    
           salesTalabTotalTmp.Total      = custInvoiceJour.InvoiceAmount;
    
           salesTable = SalesTable::find(salesId);
    
           salesLine = SalesLine::find(salesTable.SalesId);
    
           salesTotals = SalesTotals::construct(salesTable);
    
           if(salesTable.SalesStatus == SalesStatus::Invoiced)
    
           {
    
               totOfOrder  = salesTable.amountInvoiced();
    
           }
    
           else
    
           {
    
               totOfOrder  = salesTotals.totalAmount();
    
               salesTable  = SalesTable::find(salesId, false); //find the sales order
    
               salesTotals = SalesTotals::construct(salesTable, SalesUpdate::All);
    
               salesTotals.calc();
    
               cont        = salesTotals.displayFieldsCurrency(salesTotals.currencyCode());
    
               taxAmountCur = conpeek(cont, TradeTotals::posTaxTotal());
    
               salesTalabTotalTmp.Vat = taxAmountCur;
    
           }
    
           amount = totOfOrder;
    
           salesTalabTotalTmp.Total   = amount;
    
           /*
    
           amount = custTable.balanceMST()   custInvoiceJour.InvoiceAmount - custTable.CreditMax;
    
           salesTalabTotalTmp.Amount   = amount;
    
           */
    
           //     salesTalabTotalTmp.insert();
    
           //  salesTalabTotalTmp.Misc       = custInvoiceJour.SumMarkup;
    
           netString = "Company :Daffah Company \nVAT# : 300042625700003 \nDate time :"   s   "\nTot.Amount :"  num2str(custInvoiceJour.InvoiceAmount,-1,-1,DecimalSeparator::Dot,ThousandSeparator::Comma)   "\nVAT.Amount :"  num2str(custInvoiceJour.SumTax ,-1,-1,DecimalSeparator::Dot,ThousandSeparator::Comma)  ;//InputText.valueStr();
    
       }
    
       else
    
       {
    
           salesTalabTotalTmp.clear();
    
           salesTotals  = SalesTotals::construct(salesTable);
    
           salesTalabTotalTmp.Total      = salesTotals.totalAmount(); //TOTAL
    
           salesTalabTotalTmp.Vat        = salesTotals.totalTaxAmount(); //TAX
    
           salesTalabTotalTmp.Discount   = salesTotals.totalEndDisc(); //DISCOUNT
    
           salesTalabTotalTmp.Misc       = salesTotals.totalMarkup(); // MiSC CHARGES
    
           netString = "Company :Daffah Company \nVAT# : 300042625700003 \nDate time :"   s   "\nTot.Amount :"  num2str(salesTotals.totalAmount(),-1,-1,DecimalSeparator::Dot,ThousandSeparator::Comma)   "\nVAT.Amount :"  num2str(salesTotals.totalTaxAmount() ,-1,-1,DecimalSeparator::Dot,ThousandSeparator::Comma)  ;//InputText.valueStr();
    
           //     salesTalabTotalTmp.insert();
    
       }
    
       qrCode = new Microsoft.Dynamics.QRCode.Encoder();
    
       netBitmap = qrCode.Encode(netString); //encode the string as Bitmap can be used already
    
       tempFileName = qrCode.GetTempFile(netString); //to get the QR temporary file
    
       perm = new FileIOPermission(tempFileName,'r');
    
       perm.assert();
    
       binData = new binData();
    
       binData.loadFile(tempFileName);
    
       System.IO.File::Delete(tempFileName);
    
       CodeAccessPermission::revertAssert();
    
       salesTalabHedTmp.QrCode         = binData.getData();
    
       salesTalabHedTmp.insert();
    
           **/
    
       ///Qr
    
       select * from custInvoiceJour1
    
           where custInvoiceJour1.SalesId == salesId;
    
       // Logic for getting discount from charges
    
     /**  select sum(Value) from markupTrans
    
           where markupTrans.TransRecId == custInvoiceJour1.RecId
    
           && markupTrans.TransTableId == tableNum(custInvoiceJour)
    
           join markupTable
    
           where markupTable.CustPosting == LedgerPostingType::SalesDisc
    
           && markupTable.MarkupCode == markupTrans.MarkupCode;
    
       if(markupTrans)
    
           salesTalabTotalTmp.Discount   = markupTrans.Value;
    
       else
    
       {
    
           select sum(Value) from markupTrans
    
           where markupTrans.TransTableId == tableNum(custInvoiceTrans)
    
           join custInvoiceTrans
    
           where custInvoiceTrans.SalesId == custInvoiceJour1.SalesId
    
           && custInvoiceTrans.InvoiceId == custInvoiceJour1.InvoiceId
    
           && custInvoiceTrans.InvoiceDate == custInvoiceJour1.InvoiceDate
    
           && custInvoiceTrans.RecId == markupTrans.TransRecId
    
           join markupTable
    
           where markupTable.CustPosting == LedgerPostingType::SalesDisc
    
           && markupTable.MarkupCode == markupTrans.MarkupCode;
    
           if(markupTrans)
    
           {
    
               salesTalabTotalTmp.Discount  = markupTrans.Value;
    
           }
    
           else
    
           {
    
               salesTalabTotalTmp.Discount = salesTotals.totalEndDisc();
    
           }
    
       } **/
    
       // logic for getting freight from charges
    
       markupTrans.clear();
    
       markupTable.clear();
    
       custInvoiceTrans.clear();
    
      /** select sum(Value) from markupTrans
    
           where markupTrans.TransRecId == custInvoiceJour1.RecId
    
           && markupTrans.TransTableId == tableNum(custInvoiceJour)
    
           join markupTable
    
           where markupTable.CustPosting == LedgerPostingType::SalesFreight
    
           && markupTable.MarkupCode == markupTrans.MarkupCode;
    
       if(markupTrans)
    
          Â¥A0salesTalabTotalTmp.Freight  = markupTrans.Value;
    
       else
    
       {
    
           select sum(Value) from markupTrans
    
           where markupTrans.TransTableId == tableNum(custInvoiceTrans)
    
           join custInvoiceTrans
    
           where custInvoiceTrans.SalesId == custInvoiceJour1.SalesId
    
           && custInvoiceTrans.InvoiceId == custInvoiceJour1.InvoiceId
    
           && custInvoiceTrans.InvoiceDate == custInvoiceJour1.InvoiceDate
    
           && custInvoiceTrans.RecId == markupTrans.TransRecId
    
           join markupTable
    
           where markupTable.CustPosting == LedgerPostingType::SalesFreight
    
           && markupTable.MarkupCode == markupTrans.MarkupCode;
    
           salesTalabTotalTmp.Freight = markupTrans.Value;
    
       }
    
       // logic for getting miscellaneous from the charges
    
       markupTrans.clear();
    
       markupTable.clear();
    
       custInvoiceTrans.clear();
    
       select sum(Value) from markupTrans
    
           where markupTrans.TransRecId == custInvoiceJour1.RecId
    
           && markupTrans.TransTableId == tableNum(custInvoiceJour)
    
           join markupTable
    
           where markupTable.CustPosting != LedgerPostingType::SalesFreight
    
           && markupTable.CustPosting != LedgerPostingType::SalesDisc
    
           && markupTable.MarkupCode == markupTrans.MarkupCode
    
           && markupTable.VendPosting == 0;
    
       if(markupTrans)
    
           salesTalabTotalTmp.Misc  = markupTrans.Value;
    
       else
    
       {
    
           select sum(Value) from markupTrans
    
           where markupTrans.TransTableId == tableNum(custInvoiceTrans)
    
           join custInvoiceTrans
    
           where custInvoiceTrans.SalesId == custInvoiceJour1.SalesId
    
           && custInvoiceTrans.InvoiceId == custInvoiceJour1.InvoiceId
    
           && custInvoiceTrans.InvoiceDate == custInvoiceJour1.InvoiceDate
    
           && custInvoiceTrans.RecId == markupTrans.TransRecId
    
           join markupTable
    
           where markupTable.CustPosting != LedgerPostingType::SalesFreight
    
           && markupTable.CustPosting != LedgerPostingType::SalesDisc
    
           && markupTable.MarkupCode == markupTrans.MarkupCode
    
           && markupTable.VendPosting == 0;
    
           salesTalabTotalTmp.Misc = markupTrans.Value;
    
       }
    
           */
    
           /**   select firstOnly * from salesTable where salesTable.SalesId == SalesId
    
               join taxGroupData where taxGroupData.TaxGroup == SalesTable.TaxGroup
    
               join taxValue from taxData where taxData.TaxCode == taxGroupData.TaxCode;
    
    StrPercentage = strFmt("%1", taxData.TaxValue)   "%";
    
       salesTalabTotalTmp.VatPercentage = StrPercentage;
    
       salesTalabTotalTmp.insert();  **/
    
    }
    
    }

  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    The most important step is finding where the error is thrown. Use the debugger to get this information.

    Also, please always use Insert > Insert Code (in the richformatting view) to paste source code. The result won't have the extra line spacing, it'll have line numbers etc. And try to share just code relevant to the problem. A good idea is simplifying your code before sharing it with others.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 611 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans