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
*This post is locked for comments
Thanks Martin, it works
I checked the whole code again and realized that a Transdate had escaped me. That is, I was convinced that I had modified it, but in reality, Date had remained.
In the end your suggestions were right, thank you very much.
Problem solved.
Thank a lot to all.
Check your contract class. Or check below code.
[DataContractAttribute ] public class SrsRDPContractSalesAnalysis { FromDate fromDate; ToDate toDate; } [ DataMemberAttribute('FromDate'), SysOperationLabelAttribute(literalstr("@SYS5209")), SysOperationHelpTextAttribute(literalstr("@SYS26930")) ] public TransDate parmFromDate(TransDate _fromDate = fromDate) { fromDate = _fromDate; return fromDate; } [ DataMemberAttribute('ToDate'), SysOperationLabelAttribute(literalstr("@SYS14656")), SysOperationHelpTextAttribute(literalstr("@SYS26929")) ] public TransDate parmToDate(TransDate _toDate = toDate) { toDate = _toDate; return toDate; }
I've changed the date type in TransDate EDT, but it doesn't work.
I also tried to delete the dialog parameters for Fromdate and Todate and tried to restore those of the Contract, but nothing.
In both cases I recreated the CIL, updated the dataset in the VS report and repeated the deployment
I've written code for adding dialog fields for Fromdate and Todate, because the parameter declared in the Contract class are no longer shown on the report form. The only way I found them to show them is to add the "super ()" to the Build () method of the UIBuilder class. But if I add it, it duplicates the Site and Location parameters. I could not find a way to not duplicate them, so I decided to turn all the parameters into dialog.
I do not have an obligation to make the Fromdate and the Todate as Dialog, so if you have any suggestions to eliminate unnecessary code, I willingly accept them.
Thanks in advance.
Andrea
I suspect (without testing it) that the problem is in using "date" instead of an EDT. Try TransDate instead, for example.
I also wonder why you've written code for adding dialog fields and getting values from them, because the framework can do it for you automatically.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,113 Super User 2024 Season 2
Martin Dráb 229,918 Most Valuable Professional
nmaenpaa 101,156