Forums › Forums › SIMPOL Programming › access to the quickreport filter window
Tagged: filter GUI for reports
- This topic has 15 replies, 2 voices, and was last updated 7 years, 3 months ago by Michael.
- AuthorPosts
- January 4, 2017 at 4:49 pm #3426JD KromkowskiParticipant
whereclause = guigetsimplefilter(appw.w, “”, labeldef.template.mastertable.table.tablename, \
defbooleanformat=df.defboolean, defintegerformat=df.definteger, \
defnumberformat=df.defnumber, defdateformat=df.defdate, \
deftimeformat=df.deftime, defdatetimeformat=df.defdatetime, \
defdatelocale=app.SBLlocale.datelocale, \
defnumericlocale=app.SBLlocale.numlocale, datasources=app.datasources, \
tables=tables, ppcs=app.ppcs, “Customer Labels Filter”)January 4, 2017 at 4:56 pm #3427JD KromkowskiParticipantOops. pasted wrong thing. Is guigetsimplefilter() the way to access the filter GUI?
I see that graphicreport1 has property allowuserdefinedfilter but I don’t see corresponding property for quickreport1 or report1?
PS Really wish all the help docs were accessible from IDE and that you could search them all at once.
January 4, 2017 at 6:42 pm #3428JD KromkowskiParticipantI can’t seem to get guigetsimplefilter() to work.
But the source code for reportlib.sml is not available so hard for me to see what the problem is.
January 4, 2017 at 7:26 pm #3429JD KromkowskiParticipantI tried to see how it work in the Business example, where it is used with labels.
unfortuantely
labeldef =@ openlabeldef(ends up being nul so that function apparently isn’t even working.
even when I opened up one of the customer labels slx (after fixing bad reference to datasource as X:\, it is not clear to me that the filter button on the labels works at all.
So, maybe you could release the source for the gui that handles filter for updates,graphicreports, and quickreports?
JDK
January 5, 2017 at 3:02 pm #3430MichaelKeymasterHi John,
Your initial post looked relatively good from here. Yes, you should be able to call that to allow the user to construct a filter for a single table. The return value is the where clause.
As for the problem in SIMPOL Business, thanks for the heads up. I have removed the paths from the label definitions in the current version so in the next release, they should work fine. You can do the same, just remove the entire path in the
andtags from customerlabels.sxf and customerlabels_us.sxf. The first one is for A4 paper and the second one is for US Letter paper. If you are having problems with guigetsimplefilter(), can you tell me what is happening and how far you get?
Ciao, Neil
January 5, 2017 at 5:06 pm #3431JD KromkowskiParticipantI cannot get the whereclause = guigetsimplefilter( …) to work. I can’t figure out where the problem actually lies because source for sml is not available.
There error is object not found. I do not have access right now to my actual code. I will follow up
Maybe the best way to track it down would be to put some code using guigetsimplefilter() into the
quickreportsample project.So I added the following to debug
string test
test = qr.whereclause
test = guigetsimplefilter(filter = test)Error (21): Object not found
Error: a statement of function “guigetsimplefilter” was executed unsuccessfully
There is no source code available for the statementSo we’re clear I added the repguilib.sml to the project, so I can see that the function is available.
January 5, 2017 at 5:09 pm #3432JD KromkowskiParticipantI noticed your post included the caveat ” Yes, you should be able to call that to allow the user to construct a filter for a single table.” single table
The filter gui in Personal obviously is robust enough to allow multiple tables.
There is a wheel, why can’t we have access to the wheel.
JDK
January 6, 2017 at 11:23 am #3439MichaelKeymasterSorry to hear you are having problems with it. I will have a look today.
We haven’t chosen to release the code that implements the report1, quickreport1, graphicreport1, the quick report GUI, etc. because we still make changes to that (we are currently playing around with adding ODBC-based SQL support to the whole thing). Also some libraries may never be delivered in source.
January 6, 2017 at 3:59 pm #3440JD KromkowskiParticipantSo as a further test, I added the following to sb_salesreport function in the Business example. I get error 200. So something is wrong.
whereclause = guigetsimplefilter(appw.w,\
whereclause,\
app.tables.ordermst.tablename,\
app.displayformats.defboolean,\
app.displayformats.definteger,\
app.displayformats.defnumber,\
app.displayformats.defdate,\
app.displayformats.deftime,\
app.displayformats.defdatetime,\
app.SBLlocale.datelocale,\
app.SBLlocale.numlocale,\
app.datasources,\
app.tables,\
app.ppcs,\
“Test of GUI SIMPLE FILTER”)January 6, 2017 at 4:45 pm #3441JD KromkowskiParticipantAs to what you release or not, that’s up to you; figuring out errors is sometimes hard without. QuickReport is a function in SBNG Personal (which includes a filter gui). So far as I understand, SBNG Personal is written in simpol. I like to be able to call QuickReport programmatically and have it as a menu item. That doesn’t seem so complicated and is in the spirit of a SBNG as a RAD tool.
January 6, 2017 at 5:27 pm #3442JD KromkowskiParticipantI’m going to take a closer look at how it works in
donewuserfilter, where it does definitely workwhich btw took me awhile to figure out its name as I read it
done w user filter, i.e. “done with user filter” which made no sense to me
instead of
donewuserfilter,i.e. “do new user filter”
January 6, 2017 at 9:17 pm #3443JD KromkowskiParticipantSo I sort of got it working but with addition significant problems.
In the simpol business example in function sb_salesreport(…), I add the following
string tablename
tdisplayformats dispappw =@ getappwindowfromwindow(getmenuitemwindow(me))
disp =@ app.displayformats
tables =@ gettablesarray(appw)
tablename = appw.currenttable.table.tablenamethen later in the code where there is whereclause is being assigned, mine as a test now looks like (I’ve add \ here and there to avoid wrap)
//// this part is original code //////
if qr =@= .nul
wxmessagedialog(appw.w, “Error opening quick report ‘” + reportname + “‘”, sAPPMSGTITLE,\
“ok”, “error”)
else
whereclause = “CUSTOMER.CustSerNo = ORDERMST.CustSerNo AND ORDERMST.OrderedOn >= DATE(‘” + \ DATESTR(startdate,”yyyy-mm-0d”,app.SBLlocale.datelocale) +”‘) AND ORDERMST.OrderedOn <= DATE(‘” + \
DATESTR(enddate, “yyyy-mm-0d”, app.SBLlocale.datelocale) + “‘)”/// this part is new using guigetsimple filter /////////////////////
whereclause = guigetsimplefilter(appw.w,whereclause,\
tablename, disp.defboolean, disp.definteger, disp.defnumber,\
disp.defdate, disp.deftime, disp.defdatetime, app.SBLlocale.datelocale, \
app.SBLlocale.numlocale, app.datasources, tables, app.ppcs)
////////////////////////////////////////////////////////////////////So, you’ll see that it does now open the gui (not sure why it didn’t before)
1. If you hit OK and don’t change anything in the whereclause – you get an error. But you really shouldn’t because if you comment everything new out the whereclause is perfectly fine.
So, this means there is an alleged error being caught in the repguilib.sml (code to which we don’t have access)
2. If you do try to create your own filter (either by addition or edit mode), well good luck
January 6, 2017 at 9:58 pm #3444JD KromkowskiParticipantSo I have pinned down the problem to how repguilib evaluates where clauses in this particular situation. The problems lies with the joining statement. If you separate the joining statement out, and then later rebuilding it back up you can have a custom filter. See below, which works. It seems like this guigetsimplefilter is by design or error preventing JOINS. Why?
string whereclause1, whereclause2
whereclause1 = “CUSTOMER.CustSerNo = ORDERMST.CustSerNo AND ”
whereclause = “ORDERMST.OrderedOn >= DATE(‘” + \
DATESTR(startdate, “yyyy-mm-0d”, app.SBLlocale.datelocale) + \
“‘) AND ORDERMST.OrderedOn <= DATE(‘” + \
DATESTR(enddate, “yyyy-mm-0d”, app.SBLlocale.datelocale) + “‘)”whereclause2 = guigetsimplefilter(appw.w,whereclause,\
tablename, disp.defboolean, disp.definteger, disp.defnumber,\
disp.defdate, disp.deftime, disp.defdatetime, app.SBLlocale.datelocale, \
app.SBLlocale.numlocale, app.datasources, tables, app.ppcs)// try as example 1 doing nothing in the simple filter just leave the dates you picked –
// things work as expected and intended no “internal error from repguilib.sml”
// try as example 2 add with gui filter “AND ORDERMST.CustSerNo <= 24”
// you’ll see that this also works as expected.whereclause = whereclause1 + whereclause2
January 7, 2017 at 3:40 pm #3446MichaelKeymasterguigetsimplefilter() was designed to be used for the = in the selection panel. As such, it is limited to a single table statement. It intentionally disables/hides the Links button in the filter dialog.
January 7, 2017 at 4:59 pm #3447JD KromkowskiParticipantwould you consider releasing the quick report filter code (which allows for joins) or the form that the quick report filter dialog contains so that we wouldn’t have to start from scratch?
- AuthorPosts
- You must be logged in to reply to this topic.