79132374

Date: 2024-10-28 07:19:57
Score: 5
Natty:
Report link

I am getting below error, when I am importing data from CSV file - Processing line number 1 Inventory dimension site is mandatory and must be consequently be specified. Update has been canceled Import has been canceled Terminated

code:

void dataProcessing(container _line)

{

#define.newLineTag("NEW")

Query                   q               = new Query();

QueryBuildDatasource    qbds            = q.addDataSource(tableNum(InventJournalTrans));

QueryRun                qr;

InventJournalTrans      inventJournalTrans;

InventDim               inventDim;


str 10                  lineNum         = conpeek(_line,headersName.lookup(#lineNo));

ItemId                  newLineItemId   = conpeek(_line,headersName.lookup(#itemNumber));



boolean                 newLine         = lineNum == #newLineTag;

DocuRef                 docuRef;

InventJournalTable      inventJournalTableLoc;

// Date dateLoc = 24-10-2024;

//qbds.addSelectionField(fieldNum(InventJournalTrans,recId));

if (str2num(lineNum) != nullValueBaseType(types::Real))

    qbds.addRange(fieldNum(InventJournalTrans,LineNum)).value(sysQuery::value(str2num(lineNum)));

if (journalId)

    qbds.addRange(fieldNum(InventJournalTrans,JournalId)).value(sysQuery::value(journalId));

else

    qbds.addRange(fieldNum(InventJournalTrans,JournalId)).value(sysQuery::value(conpeek(_line,headersName.lookup(#journal))));


qr = new queryRun(q);

qr.next();

inventJournalTrans.selectForUpdate(true);

inventJournalTrans = qr.get(tableNum(InventJournalTrans));

if (this.validateValues(_line,newLine,inventJournalTrans,newLineItemId))

{


    inventJournalTrans.Counted                  = conpeek(_line,headersName.lookup(#counted));

    inventJournalTrans.OT_MovementReasonCode    = conpeek(_line,headersName.lookup(#reasonCode));

    if (newLine && !inventJournalTrans.RecId)

    {

       inventJournalTableLoc = InventJournalTable::find(conpeek(_line,headersName.lookup(#journal)));


        inventJournalTrans.clear(); 

        inventJournalTrans.initValue();


       inventJournalTrans.initFromInventJournalTable(inventJournalTableLoc);//(inventJournalTrans.inventJournalTable());


        if (!inventJournalTrans.EmplId)

            inventJournalTrans.EmplId   = inventJournalTableLoc.EmplId; // inventJournalTrans.inventJournalTable().EmplId;


        inventJournalTrans.TransDate    = systemdateget();//str2date("(conpeek(_line,headersName.lookup(#transDate))",123);// str2date("24-10-2024", 123); //dateLoc; // conpeek(_line,headersName.lookup(#transDate)); 

        inventJournalTrans.ItemId       = conpeek(_line,headersName.lookup(#itemNumber));

        inventDim.inventLocationId      = conpeek(_line,headersName.lookup(#warehouse));

        inventDim.wMSLocationId         = conpeek(_line,headersName.lookup(#location));

        inventDim.inventBatchId         = conpeek(_line,headersName.lookup(#batchNumber));

        inventDim.inventSerialId        = conpeek(_line,headersName.lookup(#serialNumber));


        inventJournalTrans.InventDimId  = InventDim::findOrCreate(inventDim).inventDimId;


        inventJournalTrans.InventOnHand = conpeek(_line,headersName.lookup(#onHand));


        inventJournalTrans.inventMovement().journalSetCounted();

        if (inventJournalTrans.validateWrite())

             inventJournalTrans.insert();

    }

    else

    {


        inventJournalTrans.LineNum      = conpeek(_line,headersName.lookup(#lineNo));


        inventJournalTrans.inventMovement().journalSetCounted();

        if (inventJournalTrans.validateWrite())

            inventJournalTrans.update();

    }


}

}

Please any one give solution. Thankyou in Advance for helping

Reasons:
  • Blacklisted phrase (1): Thankyou
  • RegEx Blacklisted phrase (3): Thankyou in Advance
  • RegEx Blacklisted phrase (1): I am getting below error
  • Long answer (-1):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: user28019884