Export Report To Pdf AX 2012 CU10 - axapta

I need to modify Purchase Order Form, so user can select and save PO as PDF in destination folder
I created a new Button, so after user selects data and clicks the button, system creates a PDF file and saves it to the destination folder.
This is my code
public static void main(Args _args)
{
PurchTable purchTable,purchTable2, row;
PurchPurchaseOrderController purchPurchaseOrderController ;
PurchPurchaseOrderContract purchPurchaseOrderContract;
SrsReportRunImpl srsReportRun;
VendPurchOrderJour vendPurchOrderJour;
FormDataSource purchTable_ds;
str PDFName;
int tot = 0;
Args args ;
ReportName reportName = "PurchPurchaseOrder.ReportPRI";
;
if(_args.record().TableId == tableNum(PurchTable))
{
purchTable2 = _args.record();
purchTable_ds = purchTable2.dataSource();
}
if (purchTable_ds.anyMarked())
{
row = purchTable_ds.getFirst( 1, false );
info("a1");
while(row)
{
tot++;
info(row.PurchId);
args = new Args();
args.record(row);
select firstFast purchTable where purchTable.RecId == row.RecId ;
select firstFast vendPurchOrderJour where vendPurchOrderJour.PurchId == purchTable.PurchId ;
PDFName = strFmt("C:\\SharePDF\\%1.pdf",strReplace(purchTable.PurchId,'/','_'));
purchPurchaseOrderController = new PurchPurchaseOrderController();
purchPurchaseOrderController.parmReportName(ReportName);
purchPurchaseOrderContract = purchPurchaseOrderController.parmReportContract().parmRdpContract();
purchPurchaseOrderContract.parmRecordId(vendPurchOrderJour.RecId);
purchPurchaseOrderController.parmArgs(args);
srsReportRun = purchPurchaseOrderController.parmReportRun() as SrsReportRunImpl;
purchPurchaseOrderController.parmReportRun(srsReportRun);
purchPurchaseOrderController.parmReportContract().parmReportExecutionInfo(new SrsPrintMgmtExecutionInfo());
purchPurchaseOrderController.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::File);
purchPurchaseOrderController.parmReportContract().parmPrintSettings().overwriteFile(true);
purchPurchaseOrderController.parmReportContract().parmPrintSettings().fileFormat(SRSReportFileFormat::PDF);
purchPurchaseOrderController.parmReportContract().parmPrintSettings().fileName(PDFName);
purchPurchaseOrderController.runReport();
row = purchTable_ds.getNext();
}
}
info(strFmt("%1",tot));
}
This code is running and will create a pdf file, but only for the last PO.
Any suggestions how to fix this problem? Thanks

Appear your error is in this line row = purchTable_ds.getFirst( 1, false ); you need a MultiSelectionHelper class.
Try with this code:
public static void main(Args _args)
{
PurchTable purchTable,purchTable2, row;
PurchPurchaseOrderController purchPurchaseOrderController ;
PurchPurchaseOrderContract purchPurchaseOrderContract;
SrsReportRunImpl srsReportRun;
VendPurchOrderJour vendPurchOrderJour;
FormDataSource purchTable_ds;
str PDFName;
int tot = 0;
Args args ;
ReportName reportName = "PurchPurchaseOrder.ReportPRI";
//New
PurchTable _PurchTable;
MultiSelectionHelper _helper = MultiSelectionHelper::construct();
//New end
;
//New
_helper.parmDatasource(purchTable_ds);
_PurchTable = _helper.getFirst();
while(_PurchTable.RecId != 0){
Purchtable = _PurchTable;
//New end
tot++;
//info(row.PurchId);
//args = new Args();
//args.record(row);
//select firstFast purchTable where purchTable.RecId == row.RecId ;
select firstFast vendPurchOrderJour where vendPurchOrderJour.PurchId == purchTable.PurchId ;
PDFName = strFmt("C:\\SharePDF\\%1.pdf",strReplace(purchTable.PurchId,'/','_'));
purchPurchaseOrderController = new PurchPurchaseOrderController();
purchPurchaseOrderController.parmReportName(ReportName);
purchPurchaseOrderContract = purchPurchaseOrderController.parmReportContract().parmRdpContract();
purchPurchaseOrderContract.parmRecordId(vendPurchOrderJour.RecId);
purchPurchaseOrderController.parmArgs(args);
srsReportRun = purchPurchaseOrderController.parmReportRun() as SrsReportRunImpl;
purchPurchaseOrderController.parmReportRun(srsReportRun);
purchPurchaseOrderController.parmReportContract().parmReportExecutionInfo(new SrsPrintMgmtExecutionInfo());
purchPurchaseOrderController.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::File);
purchPurchaseOrderController.parmReportContract().parmPrintSettings().overwriteFile(true);
purchPurchaseOrderController.parmReportContract().parmPrintSettings().fileFormat(SRSReportFileFormat::PDF);
purchPurchaseOrderController.parmReportContract().parmPrintSettings().fileName(PDFName);
purchPurchaseOrderController.runReport();
//New
_PurchTable = _helper.getNext();
//New end
}
info(strFmt("%1",tot));
}

This is has been solved. Thanks for All.
This is my complete Code
public static void main(Args _args)
{
PurchTable purchTable,purchTable2, row;
PurchPurchaseOrderContract purchPurchaseOrderContract;
VendPurchOrderJour vendPurchOrderJour;
FormDataSource purchTable_ds;
SRSPrintDestinationSettings settings;
SrsReportRunController controller ;
str folderPath;
dialog d;
DialogField dialogFilename;
str PDFName, FilePath;
int tot = 0;
Args args;
ReportName reportName = "PurchPurchaseOrder.ReportPRI";
PurchTable _PurchTable;
MultiSelectionHelper _helper = MultiSelectionHelper::construct();
;
d = new dialog();
d.caption("select a folder");
dialogFilename = d.addField(extendedTypeStr(FilePath));//add a field where you select your file in a specific path
d.run();
if(d.closedOk())
{
folderPath = dialogFileName.value();//return path file value
if(folderPath == '')
{
folderPath = 'C:\\SharePdf';
}
if(_args.record().TableId == tableNum(PurchTable))
{
purchTable2 = _args.record();
purchTable_ds = purchTable2.dataSource();
}
if (purchTable_ds.anyMarked())
{
row = purchTable_ds.getFirst( 1, false );
while(row)
{
tot++;
args = new Args();
select firstFast purchTable where purchTable.RecId == row.RecId ;
select firstFast vendPurchOrderJour where vendPurchOrderJour.PurchId == purchTable.PurchId ;
PDFName = strFmt("%2\\%1.pdf",strReplace(purchTable.PurchId,'/','_'), folderPath);
controller = new SrsReportRunController();
purchPurchaseOrderContract = new PurchPurchaseOrderContract();
controller.parmReportName(ReportName);
controller.parmExecutionMode(SysOperationExecutionMode::Synchronous);
controller.parmShowDialog(false);
purchPurchaseOrderContract.parmRecordId(vendPurchOrderJour.RecId);
args.record(row);
controller.parmReportContract().parmRdpContract(purchPurchaseOrderContract);
controller.parmArgs(args);
settings = controller.parmReportContract().parmPrintSettings();
settings.printMediumType(SRSPrintMediumType::File);
settings.fileFormat(SRSReportFileFormat::PDF);
settings.overwriteFile(true);
settings.fileName(PDFName);
controller.startOperation();
row = purchTable_ds.getNext();
}
}
info(strFmt("%1 Total",tot));
}
}

Related

Oracle "UPDATE" command returns 0 rows affected in my ASP .NET application but the SQL statement itself works in PL/SQL

I have this ASP.NET project working with Oracle, I have the following code for operating the DB:
public int cmd_Execute_Orcl(string strSql, params OracleParameter[] paramArray)
{
OracleCommand myCmd = new OracleCommand();
try
{
myCmd.Connection = myOrclConn;
myCmd.CommandText = strSql;
foreach (OracleParameter temp in paramArray)
{
myCmd.Parameters.Add(temp);
}
ConnectionManage(true);
int i = myCmd.ExecuteNonQuery();
myCmd.Parameters.Clear();
return i;
}
catch (Exception ex)
{
throw (ex);
}
finally
{
myCmd.Dispose();
ConnectionManage(false);
}
}
"ConnectionManage()" turns on or off the connection, the following code is from data access layer of the program:
public string Edit_DAL(string id, string jh, string jz, string jd, string wd, string gzwz, string qxlx, string sx, string jx, string jb, string cfdd, string zjqssj, string zjzzsj, string bz)
{
string sql = "update JH set jh = :jh, jz = :jz, wd = :wd, jd = :jd, gzwz = :gzwz, qxlx = :qxlx, sx = :sx, jx = :jx, jb = :jb, cfdd = :cfdd, zjqssj = TO_DATE(:zjqssj, 'yyyy-mm-dd hh24:mi:ss'), zjzzsj = TO_DATE(:zjzzsj, 'yyyy-mm-dd hh24:mi:ss'), bz = :bz where ID = :idy";
string result = null;
{
String[] temp1 = zjqssj.Split('/');
String[] temp2 = zjzzsj.Split('/');
string tempString = "";
if (temp1[2].Length < 2)
{
temp1[2] = temp1[2].Insert(0, "0");
}
for (int i = 0; i < temp1.Length; i++)
{
if (i != 0)
{
temp1[i] = temp1[i].Insert(0, "/");
}
tempString += temp1[i].ToString();
}
zjqssj = tempString;
tempString = "";
if (temp2[2].Length < 2)
{
temp2[2] = temp2[2].Insert(0, "0");
}
for (int i = 0; i < temp2.Length; i++)
{
if (i != 0)
{
temp2[i] = temp2[i].Insert(0, "/");
}
tempString += temp2[i].ToString();
}
zjzzsj = tempString;
tempString = "";
}
OracleParameter[] pars ={
new OracleParameter(":idy",id),
new OracleParameter(":jh",jh),
new OracleParameter(":jz",jz),
new OracleParameter(":jd",jd),
new OracleParameter(":wd",wd),
new OracleParameter(":gzwz",gzwz),
new OracleParameter(":qxlx",qxlx),
new OracleParameter(":sx",sx),
new OracleParameter(":jx",jx),
new OracleParameter(":jb",jb),
new OracleParameter(":cfdd",cfdd),
new OracleParameter(":zjqssj",(zjqssj.Replace('/', '-') + " 00:00:00")),
new OracleParameter(":zjzzsj",(zjzzsj.Replace('/', '-') + " 00:00:00")),
new OracleParameter(":bz",bz)
};
try
{
SqlHelper.cmd_Execute_Orcl(sql, pars);
result = "ok";
}
catch (Exception ex)
{
result = "no" + "=" + ex.Message + "\n" + ex.StackTrace;
}
return result;
}
Here's where the strange thing happens, when I hit this part of the code, there's no exception, it returns 0, no rows affected, all the values of the parameters are normal, with expected value, then I tried to run the command in PL/SQL and it works, the row is correctly updated, delete function is also referencing the same "cmd_Execute_Orcl" method and it works just fine, and for the other object the edit function is working perfectly, I am posting the code below:
public string Edit(string OriginalId, string EditUserAccount, string EditUserName, string EditUserMobile, string EditDeptId, string EditRoleId, string EditRoleName)
{
string sql = "update AuthUser set UserAccount=:EditUserAccount, UserName=:EditUserName, UserMobile=:EditUserMobile, DepartmentId=:EditDeptId, RID=:EditRoleId, RoleName=:EditRoleName where ID=:OriginalId";
OracleParameter[] pars ={
new OracleParameter(":EditUserAccount",EditUserAccount),
new OracleParameter(":EditUserName",EditUserName),
new OracleParameter(":EditUserMobile",EditUserMobile),
new OracleParameter(":EditDeptId",EditDeptId),
new OracleParameter(":EditRoleId",EditRoleId),
new OracleParameter(":EditRoleName",EditRoleName),
new OracleParameter(":OriginalId",OriginalId),
};
try
{
SqlHelper.cmd_Execute_Orcl(sql, pars);
return "ok";
}
catch (Exception ex)
{
string test = ex.Message;
return "no";
}
}
In the expected table, column ID is nvarchar2 with default value of sys_guid(), column ZJQSSJ and column ZJZZSJ is of type date, all other columns are of type varchar2, I have also tried executing "COMMIT" and reformating data for date, but the same problem is still there, plz help...

Xamarin forms: How to add tapped event on XamForms.Controls.Calendar specialdate?

I am using XamForms.Controls.Calendar package for showing calendar in my project. I am marking events on the calendar using the below code.
private void AddSpecialDateWithList(List<events> list)
{
List<SpecialDate> newList = new List<SpecialDate>();
foreach (events model in list)
{
string startDate = model.start;
int startIndex = startDate.IndexOf('T');
if (startIndex > 0)
{
startDate = startDate.Substring(0, startIndex);
}
string endDate = model.end;
int endIndex = endDate.IndexOf('T');
if (endIndex > 0)
{
endDate = endDate.Substring(0, endIndex);
}
List<DateTime> dates = GetDatesBetween(DateTime.Parse(startDate), DateTime.Parse(endDate));
for(int i=0;i< dates.Count; i++)
{
var newDate = AddDate(dates[i], model);
newList.Add(newDate);
}
}
calendar.SpecialDates = newList;
}
private SpecialDate AddDate(DateTime dateTime, events model)
{
SpecialDate newDate = new SpecialDate(dateTime)
{
Selectable = true,
BackgroundPattern = new BackgroundPattern(1)
{
Pattern = new List<Pattern>
{
new Pattern { WidthPercent = 1f, HightPercent = 0.7f, Color = Color.White },
new Pattern{ WidthPercent = 1f, HightPercent = 0.3f, Color = Color.Yellow, Text = model.title, TextColor=Color.Black, TextSize=10, TextAlign=TextAlign.LeftCenter},
}
}
};
return newDate;
}
Screenshot:
When I tap a day having event(31 Jan having maths homework), I need to get the event id and all the other details associated with that event. How can I do this feature? Also is it possible to show month, week and day view in XamForms.Controls.Calendar?
You could get the index of SpecialDate in your list in the event DateClicked
private void calendar_DateClicked(object sender, DateTimeEventArgs e)
{
int num = 0;
var specialList = calendar.SpecialDates;
var date = e.DateTime;
foreach(SpecialDate specialDate in specialList)
{
if(specialDate.Date.Year==date.Year&& specialDate.Date.Month == date.Month&&specialDate.Date.Day == date.Day)
{
events model = list[num];
// do something you want
}
else
{
num++;
}
}
}

Import Items into Ax with X++ Code

I was importing items into Microsoft Dynamics AX 2009 using the following job
static void ItemsImport(Args _args)
{
InventTable InventTable;
container c;
TextIo io;
str 130 fileName;
TextBuffer b;
integer inc;
ItemId ItemId;
AxInventTable axInventTable;
;
fileName = #"C:\Users\mom\Desktop\Items.csv";
b = new Textbuffer();
io = SysLicenseCodeReadFile::openFile(fileName,'r');
if (!io)
throw error(strfmt("#SYS18678",fileName));
io.inFieldDelimiter(";");
c = io.read();
b = new Textbuffer();
ttsbegin;
while (io.status() == IO_Status::Ok)
{
c = io.read();
inc++;
if (io.status() != IO_Status::Ok)
break;
ItemId = conpeek(c,1);
select InventTable
where InventTable.ItemId == ItemId;
axInventTable = new axInventTable();
axInventTable.parmItemId(conPeek(c, 1));
axInventTable.parmItemName(conPeek(c, 2));
axInventTable.parmNameAlias(conPeek(c, 3));
axInventTable.parmItemGroupId("PRD_CHF");
axInventTable.parmModelGroupId("PMP");
axInventTable.parmDimGroupId("Teinture");
axInventTable.axInventTableModule_Sales().parmUnitId("Kg");
axInventTable.axInventTableModule_Purch().parmUnitId("Kg");
axInventTable.axInventTableModule_Invent().parmUnitId("Kg");
axInventTable.parmBOMUnitId("g");
axInventTable.axInventItemInventSetup().axInventDim().parmInventSiteId("FIMA");
axInventTable.axInventItemPurchSetup().axInventDim().parmInventSiteId("FIMA");
axInventTable.axInventItemInventSetup().axInventDim().parmInventSiteId("FIMA");
axInventTable.axInventItemInventSetup().axInventDim().parmInventLocationId("MG_PRD_CHI");
axInventTable.axInventItemPurchSetup().axInventDim().parmInventLocationId("MG_PRD_CHI");
axInventTable.axInventItemInventSetup().axInventDim().parmInventLocationId("MG_PRD_CHI");
axInventTable.save();
}
ttscommit;
pause;
}
The records are created correctly in the table but when I open the default orders settings/Site specific order settings order form for the product,
all fields are still greyed out as if no records exists.
http://www.hostingpics.net/viewer.php?id=756928801.png
http://www.hostingpics.net/viewer.php?id=553431712.png
Has anybody faced this problem ? how I can correct the x ++ code ?
Any help would be appreciated.
Thanks,
You most likely need to change this line:
axInventTable = new axInventTable();
to this line:
axInventTable = axInventTable::newInventTable(inventTable);
This worked for me:
static void updateInventOrderSettings(Args _args)
{
InventTable inventTable;
InventItemInventSetup inventItemInventSetup;
InventItemPurchSetup inventItemPurchSetup;
InventItemSalesSetup inventItemSalesSetup;
InventDim inventDim;
;
ttsBegin;
inventTable = InventTable::find("00001", true);
inventTable.ItemGroupId = "Planning";
//.. other inventTable fields
inventTable.update();
inventDim.initValue();
inventDim.InventSiteId = "Site2";
inventDim.inventLocationId = "ARC";
inventDim = InventDim::findOrCreate(inventDim);
//Site specific setup
inventItemInventSetup.initValue();
inventItemInventSetup.InventDimId = inventDim.inventDimId;
inventItemInventSetup.ItemId = inventTable.ItemId;
inventItemInventSetup.insert();
inventItemPurchSetup.initValue();
inventItemPurchSetup.InventDimId = inventDim.inventDimId;
inventItemPurchSetup.ItemId = inventTable.ItemId;
inventItemPurchSetup.insert();
inventItemSalesSetup.initValue();
inventItemSalesSetup.InventDimId = inventDim.inventDimId;
inventItemSalesSetup.ItemId = inventTable.ItemId;
inventItemSalesSetup.insert();
//Default order settings
inventItemInventSetup= inventItemInventSetup::findDefault(inventTable.itemId, true);
inventItemInventSetup.InventDimIdDefault = inventDim.inventDimId;
inventItemInventSetup.update();
inventItemPurchSetup = inventItemInventSetup::findDefault(inventTable.itemId, true);
inventItemPurchSetup.InventDimIdDefault = inventDim.inventDimId;
inventItemPurchSetup.update();
inventItemSalesSetup= inventItemInventSetup::findDefault(inventTable.itemId, true);
inventItemSalesSetup.InventDimIdDefault = inventDim.inventDimId;
inventItemSalesSetup.update();
ttsCommit;
}

how to find which imagebutton was clicked?

I have created a function which displays a bus seat layout, dynamically. Now after adding all this dynamically created table and cells into a tag, I want to know which imagebutton was clicked.I have also mentioned proper ID to each imagebutton in cell.
public void DisplaySeatLayout(ListBus _listBus) {
//fetching data from database
SeatBUS _seatBUS = new SeatBUS();
DataTable dt = _seatBUS.GetAllSeatByBusRouter(_listBus);
//Layout generation code
ImageButton img ;
HtmlTable table = new HtmlTable();
table.Attributes.Add("runat", "server");
table.Attributes.Add("id", "LayoutTable");
HtmlTableRow [] tr = new HtmlTableRow[] { new HtmlTableRow(), new HtmlTableRow(), new HtmlTableRow(),new HtmlTableRow(),new HtmlTableRow()};
HtmlTableCell tc = null;
int SeatNo=0;
//Getting Total no of seats.
int MaxSeatNo = dt.Rows.Count;
//Iterating datatable
//Displaying labels for displaying column names in the table
for (int columnCounter = 0; columnCounter < 8; columnCounter++){
for (int rowCounter = 0; rowCounter < 5; rowCounter++){
if (SeatNo < MaxSeatNo){
if (rowCounter == 2 && columnCounter < 7){
tc = new HtmlTableCell();
Label lbl = new Label();
lbl.Text = "";
lbl.ID = "lbl " + rowCounter.ToString() + columnCounter.ToString();
tc.Controls.Add(lbl);
tr[rowCounter].Controls.Add(tc);
//reducing seat number for sake of sequence.
}
else{
//adding label in each cell.
tc = new HtmlTableCell();
Label lbl = new Label();
lbl.Text = dt.Rows[SeatNo]["NumberSeat"].ToString();
lbl.ID = "lbl " + rowCounter.ToString() + columnCounter.ToString();
tc.Controls.Add(lbl);
//adding imagebutton in each cell .
img = new ImageButton();
img.Attributes.Add("type", "image");
img.Attributes.Add("id", rowCounter.ToString());
img.CssClass = "seatRightMostRow1";
img.ImageUrl = "../Images/available_seat_img.png";
img.ID = dt.Rows[SeatNo]["NumberSeat"].ToString();
img.Click += new ImageClickEventHandler(Imagebutton_Click);
tc.Controls.Add(img);
tr[rowCounter].Controls.Add(tc);
SeatNo++;
}
}//SeatNo < MaxSeatNo
table.Controls.Add(tr[rowCounter]);
}
seatArranngement.Controls.Add(table);
}
}
this is complete code after suggestion.
function that is displaying dynamic table is inside Page_load
protected void Page_Load(object sender, EventArgs e)
{
_listBusBUS = new ListBusBUS();
_routerBUS = new RouterBUS();
_listBus = new ListBus();
_promoteBUS = new PromoteBUS();
if (!Page.IsPostBack)
{
LoadData();
}
DisplaySeatLayout();
}
Also here i have copied code in prerender
protected override void OnPreRender(EventArgs e)
{
if (MultiView1.ActiveViewIndex == 1)
{
int listBusID = int.Parse(hdlListBusID.Value.ToString());
_listBus = _listBusBUS.GetAllListBusById(listBusID);
litListBusID.Text = _listBus.ListBusID.ToString();
litRouterID.Text = _listBus.RouterID.ToString();
litArrival.Text = _listBus.Arrival.ToString();
litDeparture.Text = _listBus.Departure.ToString();
litPrice.Text = _listBus.Price.ToString();
}
else if (MultiView1.ActiveViewIndex == 2)
{
//original code starts from here
litListBusIDS.Text = litListBusIDS.Text;
litRouterIDS.Text = litRouterID.Text;
litArrivalS.Text = litArrival.Text;
litDepartureS.Text = litDeparture.Text;
litSeat.Text = hdlSeat.Value;// chkSeat.SelectedItem.Text;
litPrices.Text = litPrice.Text;
//hdlSeat.Value = chkSeat.SelectedItem.Text.ToString();
}
else if (MultiView1.ActiveViewIndex == 3)
{
litCustomerNameStep4.Text = txtcustomername.Text;
litSeatStep4.Text = litSeat.Text;
litPriceStep4.Text = litPrices.Text;
}
base.PreRender(e);
}
Also, layout is getting created twice if i click on any imagebutton.
All you have to do is get the value that you already placed inside the "id" attribute.
You can do this inside the Imagebutton_Click even you created:
protected void Imagebutton_Click(object sender, EventArgs e)
{
ImageButton b = sender as ImageButton;
string id = b.Attributes["id"]; // Returns the id
}

Dynamics AX 2009 X++ Selecting A Date Range

I am creating an X++ report, and the requirement is that the user can multi-select on a form and when they click the report menu button the values are pulled in based on the selection.
So far this is easy enough, and I can pull in Str ranges i.e. order numbers, item id's etc, but I want to be able to pull in a date range based on selection.
I have used a method which several MorphX reports use, with use of 3 key methods in X++ reporting;
setQuerySortOrder
setQueryEnableDS
and the main key one which is;
setQueryRange
The code for setQuery Range is as follows;
private void setQueryRange(Common _common)
{
FormDataSource fds;
LogisticsControlTable logisticsTable;
QueryBuildDataSource qbdsLogisticsTable;
QueryBuildRange qbrVanRun;
str rangeVanRun;
QueryBuildRange qbrLogId;
str rangeLogId;
QueryBuildRange qbrExpStartDate;
str rangeExpStartDate;
set vanRunSet = new Set(Types::String);
set logIdSet = new Set(Types::String);
set expStartDate = new Set(Types::Date);
str addRange(str _range, str _value, QueryBuildDataSource _qbds, int _fieldNum, Set _set = null)
{
str ret = _range;
QueryBuildRange qbr;
;
if(_set && _set.in(_Value))
{
return ret;
}
if(strLen(ret) + strLen(_value) + 1 > 255)
{
qbr = _qbds.addRange(_fieldNum);
qbr.value(ret);
ret = '';
}
if(ret)
{
ret += ',';
}
if(_set)
{
_set.add(_value);
}
ret += _value;
return ret;
}
switch(_common.TableId)
{
case tableNum(LogisticsControlTable):
qbdsLogisticsTable = element.query().dataSourceTable(tableNum(LogisticsControlTable));
qbrVanRun = qbdsLogisticsTable.addRange(fieldNum(LogisticsControlTable, APMServiceCenterID));
qbdsLogisticsTable = element.query().dataSourceTable(tableNum(LogisticsControlTable));
qbrLogId = qbdsLogisticsTable.addRange(fieldNum(LogisticsControlTable, LogisticsId));
// qbdsLogisticsTable = element.query().dataSourceTable(tableNum(LogisticsControlTable));
// qbrExpStartDate = qbdsLogisticsTable.addRange(fieldNum(LogisticsControlTable, APMExpDateJobStart));
fds = _common.dataSource();
for(logisticsTable = fds.getFirst(true) ? fds.getFirst(true) : _common;
logisticsTable;
logisticsTable = fds.getNext())
{
rangeVanRun = addrange(rangeVanRun, logisticsTable.APMServiceCenterID, qbdsLogisticsTable, fieldNum(LogisticsControlTable, APMServiceCenterID), vanRunSet);
rangeLogID = addrange(rangeLogID, logisticsTable.LogisticsId, qbdsLogisticsTable, fieldNum(LogisticsControlTable, LogisticsId), logIdSet);
// rangeExpStartDate = addrange(rangeExpStartdate, logisticsTable.APMExpDateJobStart, qbdsLogisticsTable, fieldNum(LogisticsControlTable, APMExpDateJobStart), expStartDate);
}
qbrLogId.value(rangeLogID);
qbrVanRun.value(rangeVanRun);
break;
}
}
Use queryValue to format your dates correctly for the query:
set expStartDate = new Set(Types::String);
rangeExpStartDate = addrange(rangeExpStartdate, queryValue(logisticsTable.APMExpDateJobStart), qbdsLogisticsTable, fieldNum(LogisticsControlTable, APMExpDateJobStart), expStartDate);

Resources