Hi to all,
I have a visualization problem with fromDate toDate dialog parameters.
This is as my report show the parameters:

as I expect them (taken from an image on the web)

first, I would expect to see the parameters, shown as calendars; second, if I click on the drop-down menu, nothing happens. The values ??can only be changed by hand, by deleting and rewriting the date.
Following all my code:
UIBuilder Class and methods:
class SRS_SALUIBuilder extends SrsReportDataContractUIBuilder
{
DialogField dialogSite;
DialogField dialogLocation;
DialogField dlgstartDateField;
DialogField dlgendDateField;
SrsRDPContractScheduledArrList srsRDPContractScheduledArrList;
}
public void build()
{
//Dialog dialogLocal = this.dialog();
srsRDPContractScheduledArrList = this.dataContractObject();
this.addDialogField(methodStr(srsRDPContractScheduledArrList, parmFromDate), srsRDPContractScheduledArrList);
this.addDialogField(methodStr(srsRDPContractScheduledArrList, parmToDate), srsRDPContractScheduledArrList);
//dialogLocal.addGroup("Stoccaggio");
this.addDialogField(methodStr(srsRDPContractScheduledArrList, parmSite), srsRDPContractScheduledArrList);
this.addDialogField(methodStr(srsRDPContractScheduledArrList, parmLocation), srsRDPContractScheduledArrList);
}
public boolean locationModified(FormStringControl _control)
{
dialogLocation.value(_control.valueStr());
return true;
}
private void lookupLocation(FormStringControl _formstringcontrol)
{
Query query = new Query();
QueryBuildDataSource qbds;
SysTableLookup sysTableLookup;
//create a table lookup
sysTableLookup = SysTableLookup::newParameters(tableNum(InventLocation), _formstringcontrol);
sysTableLookup.addLookupfield(fieldNum(InventLocation,InventLocationId));
//create a query
qbds = query.addDataSource(tableNum(InventLocation));
query.dataSourceTable(tableNum(InventLocation)).addRange(fieldNum(InventLocation, InventSiteId)).value(dialogSite.value());
//assigne the query and call lookup
sysTablelookup.parmQuery(query);
sysTablelookup.performFormLookup();
}
private void lookupSite(FormStringControl _formstringcontrol)
{
Query query = new Query();
QueryBuildDataSource qbds;
SysTableLookup sysTableLookup;
//create a table lookup
sysTableLookup = SysTableLookup::newParameters(tableNum(InventSite), _formstringcontrol);
sysTableLookup.addLookupfield(fieldNum(InventSite,SiteId));
//create a query
qbds = query.addDataSource(tableNum(InventSite));
//use a find() method to retrive the value, because the InventSite hasn't the locationId field
query.dataSourceTable(tableNum(InventSite)).addRange(fieldNum(InventSite, SiteId)).value(InventLocation::find(dialogLocation.value()).InventSiteId);
//assigne the query and call lookup
sysTablelookup.parmQuery(query);
sysTablelookup.performFormLookup();
}
public void postBuild()
{
super();
// SITE
dialogSite = this.bindInfo().getDialogField(this.dataContractObject(),
methodStr(srsRDPContractScheduledArrList, parmSite));
// register override method for lookup Site
dialogSite.registerOverrideMethod(methodStr(FormStringControl, lookup),
methodStr(SRS_SALUIBuilder, lookupSite),
this);
// register override method for Site modified
dialogSite.registerOverrideMethod(methodStr(FormStringControl, modified),
methodStr(SRS_SALUIBuilder, siteModified),
this);
// LOCATION
dialogLocation = this.bindInfo().getDialogField(this.dataContractObject(),
methodStr(srsRDPContractScheduledArrList, parmLocation));
// register override method for lookup Location
dialogLocation.registerOverrideMethod(methodStr(FormStringControl, lookup),
methodStr(SRS_SALUIBuilder, lookupLocation),
this);
// register override method for Location modified
dialogLocation.registerOverrideMethod(methodStr(FormStringControl, modified),
methodStr(SRS_SALUIBuilder, locationModified),
this);
}
public boolean siteModified(FormStringControl _control)
{
dialogSite.value(_control.valueStr());
return true;
}
Contract class and Methods:
[
//DataContractAttribute,
SysOperationContractProcessingAttribute(classStr(SRS_SALUIBuilder)),
SysOperationAlwaysInitializeAttribute
]
public class SrsRDPContractScheduledArrList implements SysOperationValidatable,SysOperationInitializable
{
PurchLineDlvDate Fromdate;
PurchLineDlvDate Todate;
InventSiteId Site;
InventLocationId Location;
}
public void initialize()
{
Site = "";
Location = "";
Fromdate = systemDateGet();
Todate = systemDateGet();
}
[DataMemberAttribute("Fromdate")]
public date parmFromdate (date _Fromdate = Fromdate)
{
Fromdate= _Fromdate;
return Fromdate;
}
[DataMemberAttribute("Location")]
public InventLocationId parmLocation(InventLocationId _Location = Location)
{
Location= _Location;
return Location;
}
[DataMemberAttribute("Site")]
public InventSiteId parmSite(InventSiteId _Site = Site)
{
Site= _Site;
return Site;
}
[DataMemberAttribute("Todate")]
public date parmTodate(date _Todate = Todate)
{
Todate= _Todate;
return Todate;
}
public boolean validate()
{
boolean ret = true;
if (Fromdate > Todate)
{
ret = checkFailed("Inserimento date errato");
}
return ret;
}
My RDP class and Methods:
[
SRSReportQueryAttribute('ScheduledArrivalList_SAM'),
SRSReportParameterAttribute(classstr(SrsRDPContractScheduledArrList))
]
public class SrsRdpScArListClass extends SRSReportDataProviderBase
{
TmpScheduledArrivalListTable tmpSAL;
}
[SRSReportDataSetAttribute('tmpSAL')]
public TmpScheduledArrivalListTable gettmpSAL()
{
select * from tmpSAL;
return tmpSAL;
}
public void processReport()
{
date fromdate;
date todate;
InventSiteId site;
InventLocationId location;
Query query;
QueryRun qr=new QueryRun(queryStr (ScheduledArrivalList_SAM));
QueryBuildDataSource dsPurchLine, dsVendTable, dsPurchAgreementHeader, dsAgreementLine, dsInventTable, dsPurchTable, dsInventDim;
PurchLine queryPurchLine;
VendTable queryVendTable;
PurchAgreementHeader queryPurchAgreementHeader;
AgreementLine queryAgreementLine;
InventTable queryInventTable;
PurchTable queryPurchTable;
InventDim queryInventDim;
SrsRDPContractScheduledArrList dataContract;
// Get the query from the runtime using ours query.
query = this.parmQuery();
// Get the parameters passed from runtime.
dataContract = this.parmDataContract();
fromdate = dataContract.parmFromdate();
todate = dataContract.parmTodate();
site = dataContract.parmSite();
location = dataContract.parmLocation();
// Add parameters to the query.
dsPurchLine = query.dataSourceTable(tablenum(PurchLine));
dsPurchLine.addRange(fieldnum(PurchLine, DeliveryDate)).value(queryRange(Fromdate, ToDate)); //fromDate..todate Range
dsVendTable = query.dataSourceTable(tablenum(VendTable));
dsPurchAgreementHeader = query.dataSourceTable(tablenum(PurchAgreementHeader));
dsAgreementLine = query.dataSourceTable(tablenum(AgreementLine));
dsInventTable = query.dataSourceTable(tablenum(InventTable));
dsPurchTable = query.dataSourceTable(tablenum(PurchTable));
dsInventDim = query.dataSourceTable(tablenum(InventDim));
dsInventDim.addRange(fieldNum(InventDim,InventSiteId)).value(site); // Range per Sito
dsInventDim.addRange(fieldNum(InventDim,InventLocationId)).value(location); // Range per Magazzino
// Run the query with modified ranges.
qr = new QueryRun(query);
ttsbegin;
while(qr.next())
{
tmpSAL.clear();
queryPurchLine = qr.get(tableNum(PurchLine));
queryVendTable = qr.get(tableNum(VendTable));
queryPurchAgreementHeader = qr.get(tableNum(PurchAgreementHeader));
queryAgreementLine = qr.get(tableNum(AgreementLine));
queryInventTable = qr.get(tableNum(InventTable));
queryPurchTable = qr.get(tableNum(PurchTable));
queryInventDim = qr.get(tableNum(InventDim));
tmpSAL.BND_ItemGGANALISI = queryInventTable.BND_ItemGGANALISI;
tmpSAL.BND_ItemTMC = queryInventTable.BND_ItemTMC;
tmpSAL.ConfirmedDlv = queryPurchLine.ConfirmedDlv;
tmpSal.DeliveryDate = queryPurchLine.DeliveryDate;
tmpSal.InventLocationId = queryInventDim.InventLocationId;
tmpSal.InventSiteId = queryInventDim.InventSiteId;
tmpSal.LineNum = queryPurchLine.LineNumber;
tmpSal.LineNumber = queryAgreementLine.LineNumber;
tmpSal.Name = queryVendTable.name();
tmpSal.OrderInPuchUnit = queryPurchLine.orderedInPurchUnit();
tmpSal.PurchaseType = queryPurchLine.PurchaseType;
tmpSal.PurchNumberSequenze = queryPurchAgreementHeader.PurchNumberSequence;
tmpSal.PurchStatus = queryPurchLine.PurchStatus;
tmpSal.PurchUnit = queryPurchLine.PurchUnit;
tmpSal.ReceivedInTotal = queryPurchLine.receivedInTotal();
tmpSal.RemainInventPhisical = queryPurchLine.RemainInventPhysical;
tmpSal.ShelfLifeUM_SAM = queryInventTable.ShelfLifeUM_SAM;
tmpSal.VendAccount = queryPurchLine.VendAccount;
tmpSAL.insert();
}
ttscommit;
}
Could you tell me where I'm wrong?
Also, can the code that I wrote be improved or optimized?
Thanks in advance to those who will answer.
Andrea