static void Explorer_UpdateProjDim(Args _args)
{
container readCon;
Dialog dialog;
DialogField dialogField;
FileName fileName;
Struct struct;
ProjId projId;
ProjTable projTable;
container ledgerDimension;
CommaTextIO commaIO;
int i, records;
#File
#file
dialog = new Dialog ("Select Project Master CSV File");
dialogField = dialog.addField(extendedTypeStr(FilenameOpen));
dialog.filenameLookupFilter(['*.CSV']);
if (dialog.run())
{
fileName = dialogField.value();
if(!filename)
{
throw error('Filename must be filled');
}
}
commaIO = new CommaTextIo(fileName, 'r');
commaIO.inFieldDelimiter(',');
readCon = commaIO.read();
if (commaIO)
{
ttsBegin;
while (commaIO.status() == IO_Status::ok)
{
readCon = commaIO.read();
if (readCon)
{
projId = conPeek(readCon, 1);
struct = new Struct();
struct.add('Brand', conPeek(readCon, 2)); // specify dimensions
struct.add('Client', conPeek(readCon, 3)); // specify dimensions
struct.add('MasterClient', conPeek(readCon, 4)); // specify dimensions
struct.add('Product', conPeek(readCon, 5)); // specify dimensions
ledgerDimension = conNull();
ledgerDimension += struct.fields();
for (i = 1; i <= struct.fields(); i++)
{
ledgerDimension += struct.fieldName(i);
ledgerDimension += struct.valueIndex(i);
}
projTable = projTable::find(projId, true);
if(projTable)
{
projTable.DefaultDimension = AxdDimensionUtil::getDimensionAttributeValueSetId(ledgerDimension);
if(projTable.validateWrite())
{
projTable.update();
records++;
}
}
else
{
error(strFmt("Projid:%1 not exists", projId));
}
}
}
ttsCommit;
}
info(strFmt("%1 records Updated", records));
}
Subscribe to:
Post Comments (Atom)
Create number sequence in D365 FO
Create the data type. Add code in the loadModule method of the appropriate NumberSeqModule subclass. Add a method to the module’s paramet...
-
Dialogbutton dialogButtonConfirm; ; dialogButtonConfirm = Box::yesNo("continue ", dialogButton::Yes, ...
-
Breakpoints Command Shortcut key Remove all breakpoints. CTRL+SHIFT+F9 I...
-
Just use the below code to remove the special character from the string. strRem('String','*'); You can replace * with...
No comments:
Post a Comment