I have created a group in the flexilayout studio to extract Invoice date. I was able to capture the value using "Date" element however for some invoices I had to capture using "Character String" element. How to provide the condition in the "Output expression" of Block element to check for any one of the values?
The best approach here is to create a new "Region"-type element. Then use the following code:
if (DateElement.IsFound) Then {
RSA: DateElement.Rect; // if date is found, then set this element region to date region
} else if (CharacterStringElement.IsFound) Then {
RSA: CharacterStringElement.Rect; // if char string is found, the set its region
} else {
DontFind; // don't find anything if everything failed
}
After this, you use this region element as a source for your "InvoiceDate" block.
Related
By default Ag Grid Quick Filter function return rows that contains search string. For example if I type "30 June" in the searchbox, quick filter will also return rows that contains "30 cars were sold by 2 June" text. How can I override default behavior to receive only rows that exactly match my search string?
What I did was the following:
In the search itself, I removed the spaces from the search criteria:
this.gridApi.setQuickFilter(event.toLowerCase().replace(" ", ""));
In each column that I wanted an exact match, I added this code in the column definition:
getQuickFilterText: (params) => { return params.value && params.value.toLowerCase().replace(" ", "");}
(That is the override method for search. See here for more details: https://www.ag-grid.com/angular-data-grid/filter-quick/)
It seems to be working for me.
To achieve the exact match results column wise, You have to do these two things :
Remove cacheQuickFilter property from your default column definition object in gridOptions as caching convert all the columns data into a string separated by backward slash. That's the reason it will not be able to search column by column.
Add getQuickFilterText function in each column definition and add a condition for a exact match else return an empty string.
getQuickFilterText: params => {
return (params.value === <quick filter value>) ? params.value : ''
}
Now the tricky part here is how to access quick filter value inside getQuickFilterText function. You can achieve this in two ways :
Assign an id to quick filter search element and then access it's value using document.getElementById('quick-filter').value
Store the quick filter search value on change and put into a store state or service and then access that inside getQuickFilterText function.
I am using AG grid enterprise to display my data. I have filters for each columns. I want to show the count of each filter element inside the filter drop-down itself. Please help. It's like if the filter shows that we have only us and Canada in the country column, I want to display the frequencies of us and canada inside parenthesis beside these filter elements
Update: added working sample
filterParams: { cellRenderer: "countryFilterRenderer"}
countryFilterRenderer(params) {
let count = this.rowData.filter(i=>i.country.name==params.value).length;
return `${params.value}(${count})`;
}
rowData:[{country:{name:..., code:...}];
rowData definition just for clarity.
For more info check doc with samples, and official demo with sources.
Update: added hot data sample
Once we need to have data - related from sorting or filtering we can use API methods: forEachNodeAfterFilter, forEachNodeAfterFilterAndSort, getDisplayedRowCount.
sportFilterRenderer(params){
let count;
if(this.gridApi.getDisplayedRowCount() != this.rowData.length){
count = 0;
this.gridApi.forEachNodeAfterFilter(node=>{
if(node.data.sport == params.value)
count++;
})
}
else{
count = this.rowData.filter(i=>i.sport==params.value).length;
}
return `${params.value}(${count})`;
}
https://plnkr.co/edit/bCI0SJ (check country and sport filters)
On sample plnkr count in sport filter would be recalculated every time once you will select\deselect anything from country filter
Update: hot changes handling via cellRenderer
So ag-grid team noticed about this issues and they have it on backlock - before this - there is no way to handle your requirement in the same way as we tried. Here you can find an issue (AG-2078)
When working with a list of items (using RangeStart and RangeEnd), how to you identify the last record?
The examples I've seen so far use IF and MERGESEQ to check for the first item or use SET to set a value to be checked later.
If I want to write some text when on the very last item, what will it look like?
{ IF { MERGESEQ } = "?" "Sign here" "" }
I'm new to Couchbase and am struggling to get a composite index to do what I want it to. The use-case is this:
I have a set of "Enumerations" being stored as documents
Each has a "last_updated" field which -- as you may have guessed -- stores the last time that the field was updated
I want to be able to show only those enumerations which have been updated since some given date but still sort the list by the name of the enumeration
I've created a Couchbase View like this:
function (doc, meta) {
var time_array;
if (doc.doc_type === "enum") {
if (doc.last_updated) {
time_array = doc.last_updated.split(/[- :]/);
} else {
time_array = [0,0,0,0,0,0];
}
for(var i=0; i<time_array.length; i++) { time_array[i] = parseInt(time_array[i], 10); }
time_array.unshift(meta.id);
emit(time_array, null);
}
}
I have one record that doesn't have the last_updated field set and therefore has it's time fields are all set to zero. I thought as a first test I could filter out that result and I put in the following:
startkey = ["a",2012,0,0,0,0,0]
endkey = ["Z",2014,0,0,0,0,0]
While the list is sorted by the 'id' it isn't filtering anything! Can anyone tell me what I'm doing wrong? Is there a better composite view to achieve these results?
In couchbase when you query view by startkey - endkey you're unable to filter results by 2 or more properties. Couchbase has only one index, so it will filter your results only by first param. So your query will be identical to query with:
startkey = ["a"]
endkey = ["Z"]
Here is a link to complete answer by Filipe Manana why it can't be filtered by those dates.
Here is a quote from it:
For composite keys (arrays), elements are compared from left to right and comparison finishes as soon as a element is different from the corresponding element in the other key (same as what happens when comparing strings à la memcmp() or strcmp()).
So if you want to have a view that filters by date, date array should go first in composite key.
I would like to learn how to display the name of the month before the current month in a Word 2003 document. I have tried over and over again to follow the instructions I found on the link below, but no matter what I try I get one of several errors, something about syntax or picture switches that I don't understand. I have tried searching and I think I just don't know how to actually put the code into MS Word. Would anyone be willing to help me take this code from your forum and enter it into my document?
Thank you!
How do I display the next month in a Microsoft Word field?
The trouble with field coding is that there are a number of locale-related dependencies. That is one possible reason why you have been unable to make the suggestions in the links you mention work. Another reason is that one suggestion there cannot possibly have worked :-)
I suggest that you try to insert the following nested field in your document, and see if that works:
{ QUOTE "2013-{ = { DATE \#M } - 1 \#00;;'12' }-01" \#MMMM }
Some notes:
- use ctrl-F9 to insert a pair of the special field code braces {} (you can't just type them on the keyboard)
- you can toggle between "field code view" and "field result view" using alt-F9. You may need to do that as you proceed
- these fields will not automatically update. To ensure that the result is for the current date, select the nested field and click F9
To insert the nested field:
- click F9. You should see
{ }
click between the braces, and type
QUOTE "2013--01" \#MMMM
so you see
{ QUOTE "2013--01" \#MMMM }
click between the two "--" and click ctrl-F9 again so you see
{ QUOTE "2013-{ }-01" \#MMMM }
click between the new { } and type
= - 1 \#0;;'12'
so you see
{ QUOTE "2013-{ = - 1 \#00;;'12' }-01" \#MMMM }
click after the ' = ' and click ctrl-F9 again so you see
{ QUOTE "2013-{ = { } - 1 \#0;;'12' }-01" \#MMMM }
click between the new { } and type
DATE \#M
so you see
{ QUOTE "2013-{ = { DATE \#M } - 1 \#00;;'12' }-01" \#MMMM }
Then select the nested field, clcik F9,and click alt-F9 as necessary to display the result.
This approach probably differs from what you have seen before because
it doesn't use a nested IF to generate the correct month
it uses a YYYY-MM-DD format to generate a date that can be used to extract the month name. That's because using formats such as DD/MM/YYYY depend on the locale (i.e. they may work if the date format is DD/MM/YYYY but not if it's MM/DD/YYYY. As far as I know, YYYY-MM-DD is either locale-independent, or as locale-independent as it gets.