In skyve, how do I do a OR filter in a list grid? - skyve

I have a list grid which I'd like to filter based on an "OR"
<filterParameter filterBinding="parent" operator="equal" valueBinding="bizId" />
OR
<filterParameter filterBinding="child" operator="equal" valueBinding="bizId" />
this provides the "and" example but not a "or" example.
https://skyvers.github.io/skyve-dev-guide/lists/#list-grid-filtering
is it possible to do an OR?

There is no way to specify a compound conditional operator like AND or OR when using filter parameters in a list grid definition.
You can however
use parameters in the list grid definition and create the OR in the filter stanza of the query or
write your own list model extension and programmatically add
compound conditional criteria to the driving document query.
I'll cover option 1 as it is easier and will satisfy your requirement.
In your metadata query add a filter stanza (there are examples of this in admin.xml such as "qEnabledReports" and "qUsersInGroup".
<query name="qExample" documentName="<document-name>">
<description>Example query with filter</description>
<filter>
<![CDATA[
(bean.parent = :bizId OR bean.child = :bizId)
]]>
</filter>
...
</query>
and then in the grid
<listGrid title="Users In Group" query="qUsersInGroup" continueConversation="false" ...>
<parameter name="bizId" valueBinding="bizId" />
</listGrid>
which defines the bizId parameter with the value from the view bean's bizId.

Related

Polymer 1.x: How to filter iron-data-table?

How do I add a filter attribute to <iron-data-table? (Please post a plunk demo.)
I forked this plunk. Then I tried to add a filter by adding the following line:
<iron-data-table
...
filter="['item.user.name.first.length', '< 5']">
Which broke the plunk. Here is the new (now broken) plunk.
The documentation here describes the filter attribute as follows:
filter An array containing path/filter value pairs that are used to filter the items.
But it lacks an example of how to use it.
How do I add a filter attribute to <iron-data-table? (Please post a plunk demo.)
This isn't a very well documented feature:
Normally, you would go about using filter-by and filter-value properties in <data-table-column> elements, but you can also access the filter property directly.
When it comes to filtering items data source, there is only "contains" kind of filtering available. So, you pretty much can't do filtering based on string length like in your Plnkr with those. For more custom filtering functionality, you need to go using a function dataSource where you can do anything you want using the filters provided as arguments for the data source function.
Anyways, in case you want still to access filter directly and for example provide a default filtering value, you need to set the value to be an array of objects, which have a path and filter property:
this.filter = [{path: 'user.name.first', filter: 'donna'}];
Here's an example: http://plnkr.co/edit/KIefwLNHeinkOgERWOvZ?p=preview

Progress hide json fields

I'm using Progress OpenEdge.
I've created a dataset and nested a few temp-tables. I put in specific fields in order to relate the temp-tables.
In xml if you want to hide the fields that you use to relate the temp-tables you would use xml-node-type "HIDDEN" next to the field where you defined the temp-table.
So when you view the xml document after "dataset handle":write-xml("whatever-paramters"). The relation fields aren't seen.
The question...
How do I do the same with json?
I can't find anything that would resemble xml's xml-node-type "HIDDEN".
See the SERIALIZE-HIDDEN attribute.
http://knowledgebase.progress.com/articles/Article/000048926

how to query and / or update xml column in mysql

I have an XML column in a MySQL database that contains a structure compared to this:
<?xml version="1.0" encoding="utf-16"?>
<ParamaterInfoTestClass xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- left out the non important elements -->
<TickerInfo>
<TickerId>15</TickerId>
<IsvId>5</IsvId>
<Ticker>SomeTicker</Ticker>
<IsvName>SomeIsv</IsvName>
</TickerInfo>
<Benchmark>
<TickerId>10</TickerId>
<IsvId>5</IsvId>
<Ticker>AnotherTicker</Ticker>
<IsvName>SomeIsv</IsvName>
</Benchmark>
<BarSize>000100</BarSize>
<SomeIdElement>1</SomeIdElement>
</ParamaterInfoTestClass>
How can I query this column in a way so I get all of the Ticker Elements.
I know how to get the value based on a parent element. Like this:
SELECT `id`,ExtractValue(`xmlstring`, '/ParamaterInfoTestClass/TickerInfo/Ticker') AS result FROM `XMLTest`;
Question 1:
Is it possible to get both tickers (read all; if there are more elements with the tickerId sub element) from the TickerInfo and Benchmark elements without knowing their names in advance. So, more or less based on a wildcard and linked to SomeIdElement (meaning, having SomeIdElement on the same row as the result of ticker)
Question 2:
How can I update every Ticker (sub) element in a xml column. Say the ticker changes from ABC to XYZ and I need to update all alements. Normally U would use something like
UPDATE `XMLTest` SET `xmlstring` = UpdateXml(`xmlstring`,'/ParamaterInfoTestClass/TickerInfo/Ticker','<Ticker>XYZ</Ticker>') where ExtractValue(`xmlstring`,'/ParamaterInfoTestClass/TickerInfo/Ticker')='ABC';
But in this case (just like the above case) I need to know every element preceding the Ticker element, to be able to update the XML. I would like to be able to update all Ticker element at once, without knowing the exact structure in advance and also when the XML content contains the specific value multiple times.
Can that be done, if so...how?
Question 3:
how can I get the XML sub elements / structure with a query?
I tried this:
SELECT ExtractValue(`xmlstring`, '/ParamaterInfoTestClass/TickerInfo') AS result FROM `XMLTest`;
Kind regards,
Matthijs

primefaces dataexport from table with column content in ui:repeat

I have a master detail resultset that I present on a datatable.
The detail is fetched and rendered within to be combined into a single output string that remains in one column.
<p:column>
<f:facet name="header">BF Order Contents</f:facet>
<ui:repeat value="#{order.listOfOrderDetails}" var="orderitem" varStatus="orderitemstatus" >
<h:outputText value="#{orderitem.product.brand.name}-#{orderitem.product.name}#{orderitemstatus.last ? '':', '}" />
</ui:repeat>
</p:column>
On the datatable, that column displays as "Some Brand-Some Product, Other Brand-Other Product"
But when I export to EXCEL, I see:
com.sun.faces.facelets.component.UIRepeat#783622ba
in that column.
Does anyone have any idea about how I can overcome this (within xhtml only). I don't want to alter the backing bean to produce the detail string.
BTW: I'm on PF3.2, Mojarra 2.1.8, EL 2.2.1-b04, JDK1.7, Tomcat7
Thanks
It can be solved in the below manner.
Column having ui:repeat should not be made exportable i.e set exportable="false" attribute for p:column.
Add one more column to display the string property (write bussiness logic to convert list of string to a comma seperated string and set it the string property)
set the style as display:none; for the new column.
so during ui display, the previous column will display and during export the new column will be displayed showing comma seperated list.
I really don't think its possible , even with overriding the exporter class in the primefaces sources it will be way to complicated...
You probably better alter the backing bean
Also, you can add a star on a bit related an issue opened by me Feature request: Datatables custom filter function - filterFunction (like sortFunction for sort)
You can write a facelet function that does the iteration in Java and returns a string.. this will work just put it to outputText, or do 2 columns one put exportable false and the other make CSS display:none

In TinyXPath how to query data by indexed by element content

I am using TinyXPath to enhance an existing test tool so data from a customer XML structure can be fetched and used.
The XML looks like this
<Platform>
<LinkData>
<Plan>
<Label>A</Label>
<Settings>
<SomeSetting1>ENABLED</SomeSetting1>
<SomeSetting2>ENABLED</SomeSetting2>
</Settings>
</Plan>
<Plan>
<Label>B</Label>
<Settings>
<SomeSetting1>ENABLED</SomeSetting1>
<SomeSetting2>DISABLED</SomeSetting2>
</Settings>
</Plan>
</LinkData>
</Platform>
Given the above structure, which I have no control of, I need to be able to construct XPath expressions for TinyXPath. Put simply TinyXPath needs to return the values in the SomeSetting1/2 fields given when the correct child Label values match (resolve to true), so the test app can use them.
I have tried the following but an struggling with the way is indexed using a child element (normally I would expect use of an attribute. Here is my attempt which does not return a result (e.g. ENABLED/DISABLED) :-
Platform/LinkData/Plan[child::Label='A']/Settings/SomeSetting1/text()
Platform/LinkData/Plan[child::Label='A']/Settings/SomeSetting2/text()
Platform/LinkData/Plan[child::Label='B']/Settings/SomeSetting1/text()
Platform/LinkData/Plan[child::Label='B']/Settings/SomeSetting2/text()
Any further help from TinyXPath gurus would be much appreciated - thanks!
This xpath will return what you're looking for with the given XML:
//Settings/child::node()/text()
This xpath will also add a check for Labels and group by concat |:
//LinkData/Plan[Label/text()='A']/Settings/child::node()/text() | //LinkData/Plan[Label/text()='B']/Settings/child::node()/text()
And this one combines them both inside the label check:
//LinkData/Plan[Label/text()='A' or Label/text()='B']/Settings/child::node()/text()
Hope this helps!