Sorting a Calculated datasource in AppMaker - google-app-maker

I have a Calculated datasource that's populated via an appscript function. When I display this datasource in a table, it works great but I can't click on the headers to sort them. I'd like to implement sorting.
I can see that sorting is specified in the Query object using Query.sorting.<fieldname>._ascending() and descending(). What I can't figure out is how to read the value that was set by these functions so I can determine how the user wants me to sort the results.
How do I determine what the desired sort is from the appmaker Query object?

I can't find any documentation around this either, but by inspecting the Query object, I found I can do this:
query.sorting.._order: true - ascending; false - descending; null - no sorting by this column.
query.sorting.._priority: 0 based priority, null - no sorting.
So assuming I have a "Title" column, by inspecting query.sorting.Title._order and query.sorting.Title._priority, I can tell if I should or how to sort by it.

Related

Count of the icon tab filter

I would really like to understand how to use the "count" property of the IconTabFilter for SAPUI5 to dynamically show the count of the result set of a table.
I have the following code -
<IconTabFilter
count="{DataSet/$count}">
<Table items="{DataSet}">
But the count is not filled automatically.
I am using an oData model that is bound on the view level. I do not want to make another backend request just for the counts. What am I doing wrong here? Is there a different mechanism that can be used?
I also tried using the updateFinished event on the table to then get the count and set it via JS but the event is triggered only on DOM placement of the table. In my case the table is hidden behind the IconTab and is not placed into the DOM till the first time the user clicks the tab so its useless.
Really would appreciate some insight into how to use this!
Thanks!
Okay, so what I did was I bound my information to a local model and did an oData $expand query to fetch the entire pages information in one call.
This worked out for me because I had several sets of data to be fetched. Before they were bound individually to tables, now they are all in one query.
In the .done() method of the call I just used the setCount method of the IconTabFilter to set the count as per the return data set.

Custom Filtering with Like Keyword-GridView

I am using custom SPgridview with Filtering, and Sorting. In Filtering for the Query I have used has a condition as follows.
" AND SupplierActiveStatus LIKE '%{0}%'"
This has two values in DB. "Active" or "Inactive". This filter applies perfectly when you filter by Inactive. Due to "like" condition for the Active users it shows both types of uses without Filtering.
Please help me to find the correct filter expression to equal two strings.
Thanks in Advance.
Why not get rid of the LIKE and just say:
AND SupplierActiveStatus = '{0}'
Since you have only two statuses, there's no reason to match on a wildcard with LIKE

crossfilter filter does not apply on update data. Is it by design?

I am managing a large dateset using crossfilter in my recent project, in which I will need ability to change the data value (a bool). However after the value changed, the filter on this property does not filter out changed item. For instance I have large dataset whose data has a property of Boolean named as 'Ignore'; I create a dimension for this property to filer out the data have ignore= true. In app, user has a capability to change this value from false to true. after value changed true, clear filters and refilter the data on this dimension, I am still getting the data item which supposed being filterred out. Is it by design or there is way to around it?
From the API Docs and source it appears this behaviour is not supported.
https://github.com/square/crossfilter/wiki/API-Reference

Multiple value selection and optional filter in SSRS 2005 report

I had done a fair share of research before asking this here.
Firstly, i would like to create a drop-down filter #accessVar with the ability to select multiple values. It would be easy if not due to my special requirement. My dataset statement is:
SELECT PASS_M, ENTRY_DT, EXIT_DT, WORKED_HRS, ACCESS_LOCATION_X, IC_N, COMPANY_M, CONSECUTIVE_D
FROM TEMP_TARGET
WHERE (CONSECUTIVE_D >= #consecDays) AND (ENTRY_DT BETWEEN #startDate AND #endDate) AND
(ACCESS_LOCATION_X LIKE #accessVar) AND
(IC_N LIKE #icVAr)
However i need to make use the %wildcard for #accessVar(e.g 'BT%') hence i am unable to use the operator IN. What can i do? I am using SSRS2005. Please advice me.
You can do this using Filter at the Data Set properties. Before that you need to remove the (ACCESS_LOCATION_X LIKE #accessVar) from your data set query.
set the expression as follows[Modify your parameter name].
=ACCESS_LOCATION_X Like "*"+Parameters!param.Value+"*"
Then configure the Dataset properties Filter tab as follows.
After that you can run your report. Following screenshot searches for "en" word in the report data set and returns the result set.
Hope this helps!

Using 'Filter by Column Value' and multi column filtering using a java vector - xPages

I have an xPage which I have built with 3 combo boxes and 1 view control. I would like to use the 'Filter by column value' option within the view control to provide the options to filter the values, allowing the user to display any combination of the combo boxes. e.g. Only comboBox1, or comboBox1 and comboBox2, or comboBox3 only, or comboBox1 and comboBox2 and comboBox3.
I used the example in the 'xPages Demonstration Application' (http://www-10.lotus.com/ldd/ddwiki.nsf/dx/xpagesdemoapp.htm or http://xpagesblog.com/XPagesHome.nsf/Entry.xsp?documentId=AAC8E26599256FDC852578CB0066CC13) to do the multi-column filtering using a vector of non-categorized columns.
So, I have come across what appears to be a fairly major issue whereby the data needs to be sorted by date. Date is not one of the filters, but it needs to be the first column in order for the data to be sorted correctly. So my first column is a string, YYYYMMDD, to ensure the data is sorted correctly. I tried to use the sort option within the view control and that does not appear to work with the column filtering implemented in this manner.
So, as Date one of the criteria I am filtering by, I have passed that as an empty string - using the thought process that an empty string will select all (as in the url examples above).
The code I have used to do the filtering is:
var vtr:java.util.Vector = new java.util.Vector();
var t1 = sessionScope.Email;
var t2 = sessionScope.Own;
var t3 = sessionScope.Module;
vtr.addElement("");
#If(sessionScope.Own=="My calls",vtr.addElement(t1),vtr.addElement(""));
#If(sessionScope.Own=="My calls",vtr.addElement(""),vtr.addElement(t2));
#If(sessionScope.Status=="Open",vtr.addElement("Open"),vtr.addElement(""));
#If(sessionScope.Module=="All",vtr.addElement(""),vtr.addElement(t3));
return vtr;
What I have found is that not all data is being returned. I thought this might be due to the date field. So I removed it (changing the view and removing the first add element), and yet I still find that not all data is being returned. I suspect that this might be due to the empty strings being passed, or, that this does not actually work the way I had hoped.
Does anyone know if I can get this working the way I want it to, and if not, do you have any suggestion on how I can go about this?
Date is not needed as the first sortable column in the view. The first column does need to be sorted for the lookup to work just like the Notes view needs to be sorted for #DbColumn and #DbLookup to work. XPages uses the same underlining architecture. This example - http://dev.openntf.org/demos/demoapp.nsf/viewFilteringVector.xsp - works without the data being sorted by Date.
My guess as to why your example isn't working is down to how your Notes view sorted. Try creating a new view with column 1 (email) ascending sort, column 2 (own) ascending sort, and column 3 (module) again ascending sort. You should be able to get vector filtering working in this situation.
If all that doesn't work for you, you might consider multi-layer category filtering (new to 853). This filtering type in XPages is related to how categoryFilter works but allow you to filter a view by the sub-category (or sub-categories) too. This technique might suit your scenario better. Hope this helps.

Resources