Updating price disc table to date, based on from date with and or without specific price group

I'm not very fond of the developer side of ax and writing jobs to update fields, but I'm trying to update PriceDiscTable.ToDate based on the PriceDiscTable.FromDate

 

I have:

static void DT_PriceDiscToDate(Args _args)
{
    PriceDiscTable  priceDiscTable;
    ;
    priceDiscTable.ttsbegin();
    while select forUpdate priceDiscTable where priceDiscTable.FromDate = 21/07/2017
    {
        priceDiscTable.ToDate = "31/12/2017";
        _priceDiscTable.update();
    }
  
 
I've tried the '," etc surrounding the from date, but as I said I'm not very fond of this area and keep getting a syntax error.
 
I also would like to expand on this and update the PriceDiscTable.ToDate based on the from date & a specific price group
 
Thanks
  • static void DT_PriceDiscToDate(Args _args)
    {
    PriceDiscTable priceDiscTable;
    ;
    ttsBegin;
    while select forUpdate priceDiscTable
    where priceDiscTable.FromDate == mkDate(21, 07, 2017)
    {
    priceDiscTable.ToDate = mkDate(31,12,2017);
    priceDiscTable.update();
    }
    ttsCommit;
    }

  • In reply to Kranthi:

    You can also use a set based operation,
    update_recordSet priceDiscTable
    setting ToDate = mkDate(31,12,2017)
    where priceDiscTable.FromDate == mkDate(21, 07, 2017);
Related
Recommended