Quantcast
Channel: Martin Dráb's Activities
Viewing all 17532 articles
Browse latest View live

How to use Extensible enums in code for comparison like greater than

$
0
0

Good Morning,

As i am trying to use ProdStatus in comparing with code like

Ex :- 

if((ProdTable.ProdStatus > prodStatus::Created))
{

// Perform Operation

}


How can i use this should i manually compare all enum values with == operator with all the values after created.

If yes then if i have standard enum which is isExtensible - True with 100 elements should i add all the 99 for 1 comparison like >1.

Please show some light on this.

Regards.

Have a great day.


Printing the .Pdf file from Docuref Table using X++ code

$
0
0

Hi All,

I have stored one .pdf file to the Site's Attachments and I want to print that attachemnt with the Salesconfirmation report when the print destiantion of the Report is Printer. To acheive this I have used the following code..

public static void main(Args _args)
{
InventSite site = InventSite::find(‘A’);
DocuRef _docuRef;
System.Byte[] reportBytes;
System.IO.MemoryStream stream;

_docuRef = DocuRef::findTableIdRecId(curExt(), tableNum(InventSite), site.RecId);
SrsReportPrinterContract activePrinterContract = SrsReportRunUtil::getActivePrinter(‘Lexmark MX310 Series Class Driver’);

SRSPrintDestinationSettings srsPrintDestinationSettings = new SRSPrintDestinationSettings();
srsPrintDestinationSettings.printMediumType(SRSPrintMediumType::Printer);
srsPrintDestinationSettings.fileFormat(SRSReportFileFormat::PDF);
srsPrintDestinationSettings.printerName(activePrinterContract.parmPrinterName());
srsPrintDestinationSettings.printerWhere(activePrinterContract.parmPrinterPath());
srsPrintDestinationSettings.numberOfCopies(1);
srsPrintDestinationSettings.collate(false);
srsPrintDestinationSettings.printOnBothSides(SRSReportDuplexPrintingSetting::None);
srsPrintDestinationSettings.printAllPages(true);
srsPrintDestinationSettings.fromPage(0);
srsPrintDestinationSettings.toPage(0);

container fileCon = DocumentManagement::getAttachmentAsContainer(_docuRef);

if (fileCon)
{
stream = Binary::constructFromContainer(fileCon).getMemoryStream();

reportBytes = stream.ToArray();

if (stream)
{
DocumentContract documentContract = DocumentContractFactory::Instance.Create(DocumentContractType::Pdf);
documentContract.Name = _docuRef.Name;
documentContract.Contents = reportBytes;
documentContract.TargetType = TargetType::Printer;
documentContract.Settings = srsPrintDestinationSettings.printerPageSettings();
documentContract.ActivityID = newGuid();
// file::SendFileToUser(stream, _docuRef.Name +’.pdf’);
SrsReportRunPrinter::sendDocumentContractToDocumentRouter(documentContract);
}
}
}

When i see the Document routing status form the Status is succeeded but the file wasn't sent to the printer where as the standard confirmation report sent to the printer correctly.

While debugging i found that the standard report uses SrsReportRunPrinter/toDocumentRouter method whereas my logic follows SrsReportRunPrinter/toDocumentRouterAsPdf method.

Can anyone suggest me how can i send .pdf file attachemnt to printer using x++ code ?

I have discussed about the same in thread too...

Thanks in Advance...

DELETE FROM VENDPAYMSCHEDLINE WHERE..... (SQL Script running multiple times)

$
0
0

Hi all, 

We have recently configured Dynamics Perf software and is running successfully. When investigating the result we see a DELETE query running multiple time throughout the day and taking a considerable amount of resource in the process. 

The script is

DELETE FROM VENDPAYMSCHEDLINE WHERE ((RECID=@P1) AND (RECVERSION=@P2))

Does anyone know where the script is scheduled to run and what this is used for?

Many thanks

complex ranges in dynamic X++ queries

$
0
0

Hello,

 I'm trying to rewrite the following SQL code to dynamic X++ query:

      while select BOMId from bomVersion
            group by routeOpr.IsTechnReasonable_ICL,bom.ItemId,ecoResProduct.RecId
            where bomVersion.ItemId==itemIdProduction &&
                  bomVersion.Active == NoYes::Yes &&
                  bomVersion.FromQty == #bomVersionFromQty &&
                  (
                    (bomVersion.FromDate==dateNull() && bomVersion.ToDate == dateNull())||
                    (bomVersion.FromDate<= systemDateGet() && bomVersion.ToDate >= systemDateGet())||
                    (bomVersion.FromDate<= systemDateGet() && bomVersion.ToDate == dateNull())
                  )


I write the following:

static void Job74(Args _args)
{
    Query                   query;
    Queryrun                qr;
    QueryBuildDataSource    qbdsBomVersion;
    BOMVersion              bomVersion;
    
    
    query = new Query();
    qbdsBomVersion = query.addDataSource(tableNum(BOMVersion));
    qbdsBomVersion.addRange(fieldNum(BOMVersion,ItemId)).value(queryValue("7075"));
    qbdsBomVersion.addRange(fieldNum(BOMVersion,Active)).value(queryvalue(SysQuery::value(NoYes::Yes)));
qbdsBomVersion.addRange(fieldNum(BOMVersion,FromQty)).value(queryValue("1")); qr = new QueryRun(query); info(qr.query().dataSourceNo(1).toString()); }


I can't understand how to write this part:

                    (bomVersion.FromDate==dateNull() && bomVersion.ToDate == dateNull())||
                    (bomVersion.FromDate<= systemDateGet() && bomVersion.ToDate >= systemDateGet())||
                    (bomVersion.FromDate<= systemDateGet() && bomVersion.ToDate == dateNull())


Seems like here are two ranges. Tried to use something like this:

qbdsBomVersion.addRange(fieldNum(BomVersion,FromDate)).value(strfmt("((%1.%2 == %4) && (%1.%3 == %4)) || ((%1.%2 <= %5) && (%1.%3 >= %5)) || ((%1.%2 <= %5) && (%1.%3 == %4))",
                            qbdsBomVersion.name(),fieldstr(BOMVersion,FromDate),fieldStr(BOMVersion,ToDate),dateNull(),systemDateGet()));


But with no success. Could you please assist with this?

Thank you.

Load balancer configuration in AXC file

$
0
0

Hi,

we are experiencing slow repsonses in general usage opening forms etc and running bacth jobs.

In our developement envroment it has one AOS which is also used as a batch server - This is running quite smooth

The LIVE enviroment has 5 AOS servers, 3 Batch servers and 2 load balancers. - This is running very slow compared to the developement enviroment.

We have done numerous updates in dev compiled and then deployed the model store to LIVE so the base should be the same.

I am looking at the AXC file created for us and i see no mention of the load balancers and have read they should be first in the config file. I can only see 3 of the AOS's in the file.

Without creating a new version is there a way i can validate the exisitng one is correct?

i know there is more to check but i want to clear this off first as all the hardware and related setup up is the same so I would expect it to be faster with more AOS's not slower.

Credit Card / Online Payment Services

$
0
0

Hi all,

Because the AX / Online payment services are discontinued, which solution is being offered to handle Credit Card payments within the Sales Order Process.

We are working with Ingenico / Ogone as payment service gateway on our webshop, so would like to connect AX to this Gateway.

Anyone ?

Handling Customer Payments of Sales Invoices

$
0
0

Hi all,

I am trying to figure out how to handle huge amount of payments per day of customer payments of sales invoices from the bank account statement.

When we download a structured BAI2, ISO2022, or..... file from our bank we would like to automatic match this with the customer sales invoice, is there any possibility ?

I already researched the bank statement and matching function but this does not cover our needs, ofcourse there are ISV solutions but would like to know if someone already faced this challenge and how made a solution for this.

Thanks!

Construct Form using SysExtension pattern in D365

$
0
0

Hey,

 Just wondering if this possible in D365 or not . I wanna run different forms based on some Parameter value so I am thinking if this possible to construct Formrun using SysExytension pattern like we do for classes ( decorate class with some attribute and construct using SysExtension framework) ?

Please suggest .

Thanks


Convert HTML file to PDF in D365 using X++ code

$
0
0

Hello everyone,

I'm working in a scenario where in D365, I need to convert the HTML file to PDF. Is there any way to achieve this with X++ code?

Can we use one license for multiple users?

$
0
0

Hi,

My client has already bought 10 licenses, but it's estimated that along with the 10 users that would use Axapta on a daily basis, 5 top managers would also like to log in and run reports once a month, so in order to cut costs I have the following question:

Is there a way for the 5 users to use Axapta by using the existing 10 licenses or do we need to buy other licenses for them too? 

Currently the client is using only Enterprise CALs assigned to individual users. I can suggest to them to think of buying Task or Functional CALs, if they are using only certain functionalities of Axapta, but I need an answer to the general question first.

Thanks.

Best Regards,

Evgeni Dyulgerov

Customizing the Record template mechanism.

$
0
0

Hello,

Environment: AX7 8.0 / Update 22

Using the record template option when creating a new record is a neat feature in AX.
Unfortunately, it seems to be limited to a certain number of tables/forms.

Technical, only the following tables groups support record templates : Main, Group.
Besides the table group, there are is also an issue with table inheritance and derived table templates.

Before digging deeper, I wondered if someone had a Record template customization experience.
What could be the possible reason of the limitations named above ?

An advice on the issue is welcome.

Thank you.
Kind regards,

Saso

Help installing AX 2012 R2 in test environment

$
0
0

Hello Everyone,

Am doing a fresh installation of AX 2012 R2 in my test environment but each time I try it fails. Am installing the following components:

Application Object Server, Client, Business intelligence (Reporting Service extension and Analytic Services Configuration)

Apparently, AOS fail to start to finish the installation of the additional components. When I check the event log, its says"Object Server 01:  Fatal SQL condition during login. Error message: "The internal time zone version number stored in the database is higher than the version supported by the kernel (5/2). Use a newer Microsoft Dynamics AX kernel."

This is Fix by running the command

USE [Databasename]

Update SQLSYSTEMVARIABLES set value=2 where parm='SYSTIMEZONESVERSION'; 

After this was able to manually start AOS and install the addtional components.  But I think something is not right because my cubes are not appearing under AOS->System administration->BI-> Analyst Server-> OLAP database....

Can some please say why my installation is not going as smooth as it should without me having to do all of this? Please note I have copied the DB from my productive environment and have it in test.

Build a query with SortField not sorting as expected

$
0
0

I need to achieve the following SQL statement in X++ when creating my query.

"

select itemid, RANKSALESFREQUENCY, RANKSALESQUANTITY

from TMC_RANKSALESBYWHSE, MCRINVENTTABLEINDEX, INVENTDISTINCTPRODUCT

where MCRINVENTTABLEINDEX.SEARCHTEXT like'%red%'

and TMC_RANKSALESBYWHSE.product = MCRINVENTTABLEINDEX.REFRECID

and TMC_RANKSALESBYWHSE.inventsiteid ='1210'

and INVENTLOCATIONID ='hou'

and INVENTDISTINCTPRODUCT.product = TMC_RANKSALESBYWHSE.PRODUCT

orderby RANKSALESQUANTITY desc

"

 

The above SQL-statement sorts the itemIds retrieved from the full text search in the RankSalesQuantity descending order.

However when I try to create that in X++, the sort is not applied to the overall result. It is as if it is only applied to TMC_RankSalesByWhse.

Below is my code

****

            Query queryLocal   = new Query();

            QueryBuildDataSource    qbds, qbds2;
            QueryBuildRange         qbr;

            vSearchText = strReplace(_mcrSearchText, '%', '*');

            qbds   = queryLocal.addDataSource(tableNum(MCRInventTableIndex));
            qbr    = qbds.addRange(fieldNum(MCRInventTableIndex, searchText));

            if (mcrFullTextParameters.SearchType == MCRSearchMatchType::Full)
            {
                qbr.rangeType(QueryRangeType::FullText);
                qbr.value(SysQuery::value(vSearchText));
            }
            else
            {
                // If the user added their own wild card do not wrap the search text
                if (strFind(vSearchText, '*', 1, strLen(vSearchText)))
                {
                    qbr.value(vSearchText);
                }
                else
                {
                    qbr.value(SysQuery::valueLike(vSearchText));
                }
            }
            qbds2 = SysQuery::findOrCreateDataSource(queryLocal, tableNum(TMC_RankSalesByWhse), tableNum(MCRInventTableIndex));
            qbds2.joinmode(JoinMode::InnerJoin);
            qbds2.relations(false);
            qbds2.addLink(fieldnum(MCRInventTableIndex, RefRecId), fieldnum(TMC_RankSalesByWhse, Product));
            SysQuery::findOrCreateRange(qbds2, fieldNum(TMC_RankSalesByWhse, InventSiteId)).value(salesTableSite);
            SysQuery::findOrCreateRange(qbds2, fieldNum(TMC_RankSalesByWhse, InventLocationId)).value(salesTableWhse);
               
            qbds2.AddSortField(fieldNum(TMC_RankSalesByWhse, RankSalesQuantity), SortOrder::Descending);

****

It doesn't want to show me the query generated from the above, only the 2 pieces.

qbds:

{SELECT * FROM MCRInventTableIndex(MCRInventTableIndex_1) WHERE ((SearchText LIKE N'*red*'))}

qbds2:

{SELECT * FROM TMC_RankSalesByWhse(TMC_RankSalesByWhse_1) ORDER BY TMC_RankSalesByWhse.RankSalesQuantity DESC WHERE MCRInventTableIndex.RefRecId = TMC_RankSalesByWhse.Product AND ((InventSiteId = N'1210')) AND ((InventLocationId = N'HOU'))}

 

queryLocal = {Query  object f71e3a00}

This statement is supposed to give me the string: str showQ = QueryRun.query().DataSourceNo(1).toString();

However I get: "SELECT * FROM MCRInventTableIndex(MCRInventTableIndex_1) WHERE ((SearchText LIKE N'*red*'))"

 

So, is there something wrong with my query?

 

The only other way I can see how to do it and hopefully the orderDesk will have permission to run an SQL statement, and it is to build the actual SQL statement like in class and method: PriceDiscAdmSearch.reNumberLines and PriceDiscAdmSearch.executeStatement(sqlStmt)

Construct Form using SysExtension pattern in D365

$
0
0

Hey,

 Just wondering if this possible in D365 or not . I wanna run different forms based on some Parameter value so I am thinking if this possible to construct Formrun using SysExytension pattern like we do for classes ( decorate class with some attribute and construct using SysExtension framework) ?

Please suggest .

Thanks

Convert HTML file to PDF in D365 using X++ code

$
0
0

Hello everyone,

I'm working in a scenario where in D365, I need to convert the HTML file to PDF. Is there any way to achieve this with X++ code?


SalesOrderLineEntity validation extension

$
0
0

Hi all,

Please excuse me if any of this is incorrect or not needed, i'm still fairly new to x++ development.  I'm trying to add some validation to the SalesOrderLineEntity to stop users importing qty's that are not divisible by multiple qty.  This is how far i've gotten, I can't workout how to write in x++ (if ordered qty not divisible by multiple qty (i.e. not whole number)) then throw an error... any help would be appreciated!  Thanks.

[ExtensionOf(tableStr(SalesOrderLineEntity))]
final class SalesOrderLineEntity_Extension
{
  boolean validateWrite()
  {
  InventItemSalesSetup inventItemSalesSetup;
  SalesLine salesLine;

  SalesTable salesTable = SalesTable::find(this.SalesOrderNumber);

  select firstonly * from salesLine where salesLine.salesid == salesTable.SalesId
  join inventItemSalesSetup where inventItemSalesSetup.ItemId == salesLine.ItemId;

  if (this.RecId)
  {
    if (salesLine.QtyOrdered < inventItemSalesSetup.MultipleQty)
    {
        return checkFailed ("qty ordered less than multiple qty");
    }
    if (isInteger(salesLine.QtyOrdered / inventItemSalesSetup.MultipleQty))
    {
        return checkFailed ("qty ordered not divisible by multiple qty");
   }
}

  next validateWrite();

  if (!salesTable.checkUpdate(true, true, true))
  {
      return false;
   }

   boolean ret;

   //ret = super();

   return ret;

}

}


Entity type: Directory

$
0
0

Hello,

In AX2012 there was a feature for Entity type: Directory (in Stage data execution window), where you can specify Processing, Completed and Error directory.

is this feature removed or replaced in D365?

Regards,

David

Salesquotation through batch job

$
0
0

Dear all,

Can you please let me know I am working in one batch job , which is creating a Sales Quotation through batch job.

So, we added 2 enum fields in customized table isSyncd and isSyncError.

If SalesQutattion successfully done then the line is checked YES in IsSyncd and

If not means is data having some issues then it will not create Sales Quotation and it will be marked with IsSyncError = yes.

So, we kept those in separate form " SalesQuotationTracking" form to track which records are not created Sales Quotation means IsSyncError = YES

So, User will rectify those record and click on send button in form " SalesQuotationTracking" then it has to go through same batch to create Sales Quotation through batch.

My question is

Already 1 batch is running every 10 minutes in everyday to create Sales Quotation and it has track everyday which records are fail to create Sales Quotation. Means IsSyncError = YES

How i will run same batch job again after rectifying those record which is failed to create SalesQuotation means IsSyncError = YES

Is it possible to run the same batch job ( means which we can run from form to press SEND buttin)simenteniously because already same batch job is running everyday after 10 minutes gap.

Please give me more she'd on this

Thanks!

Sending data from third party to import into D365FO.

$
0
0

I am developing an application for D365FO and have a requirement from client so he can send data to D365FO to integrate with my application.

Our client will set up the unique field to track which data has been added to D365FO database and will send collection of data every a couple of hours.

So I am thinking the data entities  so our client can send the data through rest api. 

1. My questions is since we don't go through data import/eport module the data won't go through the staging table how can I validate those data to make sure all required fields are filled?

2. Is there any limitation of size of data our client can send through data entity. 

3. Is there any way to limit our client to send data every 5 minutes instead of every seconds?

4. Is there any better approach to do this?

How to upload a file to AZURE storage from our local folder in D365 using x++?

$
0
0

Dear all,

when i clicked on upload button in a form,i need to upload a file(.Xlsx) from my local folder(C://temp) to AZURE storage .

How to achieve it ? please suggest. i am not aware of the file storage and Blob storage.

Viewing all 17532 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>