Using Value objects in react select - react-select

I am trying to use values of objects for the select options:
option:1 {label: "Age-5", value:{name:"Age", value:"5"}}. option:1
{label: "Age-5", value:{name:"Age", value:"5"}}. option:1 {label:
"Age-5", value:{name:"Age", value:"5"}}.
But When the options are chosen, they don't get matched against the selected values 👍
image
I have tried valueRenderer option too, but can't quite get that to working. Any pointers to fix this is much appreciated.

Related

Karate graphql variables inside query

I am trying to insert previously defined variable inside graphql query but I'm not able to find any example on how to do that except creating variables outside of query text and then making request with variables.
There is one problem for me for example in this example
queries: [{type: TERM, match: EQUAL, field: "fieldOne", value: "#(id)"},
{type: TERM, match: EQUAL, field: "fieldTwo", value: null}]
I want to insert value #(id) only for the first object in graphql query. Can anyone please provide some example for me or any suggestions on how to do that?
Alright I was thinking that it will be possible to directly replace text inside query, but I found solution from karate documentation with.
queries: [{type: TERM, match: EQUAL, field: "fieldOne", value: "<id>"},
{type: TERM, match: EQUAL, field: "fieldTwo", value: null}]
enclose id inside query text in angle brackets <> and then replace id inside query with id stored in variable id by calling
* replace query.id = id

Python List / Variables

I'm a newbie programmer using python and I need help badly. I have a large FDF form that I need to populate and the entry field list is in a txt file which I read into a (my)list.
mylist = {'NAME', 'ADDRESS', 'PHONE', ....}
Is there a way to create variables to each of the element in my list and assign values to them. Like I want to assign:
NAME = 'John Doe'
ADDRESS = '99 Elm Street'
PHONE = '555-364-1234'
Appreciate any help!
If you are asking what I think you are asking, perhaps what you want isn't a list, but a dictionary.
Here's more info:
https://www.tutorialspoint.com/python/python_dictionary.htm

get grouped results with sparql query

I still feel like a SPARQL newbie, so I may be way off base about what SPARQL GROUP BY does, but here's my questions.
Suppose I wanted to request all resources in graph database called Categories, and I wanted to get all the items associated with these categories, along with the names of the items and their price.
Right now my SPARQL queries are giving me back something like the following table:
**Categories Item ItemName ItemPrice**
Tools HammerID Hammer $12
Tools SawID Saw $13
Tools WrenchID Wrench $10
Food AppleID Apple $5
Food CornID Corn $1
I wanted to use GROUP BY to group the items under a single category, so that when I start processing it, I can look through each unique category and then display the items that belong in that category.
Right now if I loop through the above results, I will be iterating over 5 entries instead of 2.
The other way I can describe the results I want are by imaging what the corresponding json data would look like. I want something like:
[
tools: [
{id: hammerId
title: hammer
price: $12},
{id: sawId
title: saw
price: $13},
{id: wrenchId
title: wrench
price: $10}
],
food: [
{id: appleId
title: apple
price: $5},
{id: cornId
title: corn
price: $1}
]
]
With the results, like this I can directly loop over the top level items, and then display the results for each.
Can I use GROUP BY to tell SPARQL to give me results like this?
No, you can't. A SPARQL SELECT query-result is defined as a sequence of solutions, with each solution being a set of variable-value pairs (with a value being defined as an IRI, BNode, or literal value). Basically it's a simple table. There is no provision for 'nested' solutions like you'd need for your JSON-like structure.
However the difference is purely syntactic. If you group, you know the result will deliver all solutions belonging to the same group together (one after the other) - so in processing the result you can simply treat the grouped variable as a marker. And of course if you really want, you can easily rewrite the query result into this kind of syntactic structure yourself - it's just a different way of writing down the exact same information, after all.

How to combine where statements in Zend Framework 2

That may be a silly question, but I just can't find any answer to it.
I have a simple query like 'SELECT * FROM table WHERE (x=a AND y=b) OR z=c' and I just can't find out how to implement that in ZF2.
I found a lot of information on Predicates and Where objects, but I can't find out how to combine that information into a query consisting of AND and OR.
I'd really appreciate it if someone can point me to the right direction.
If you want to add them using AND, you can simply pass them into the select object using an array, for example:
$select->where(array(
'type' => 'test,
'some_field' => '1'
));
If you want more complex Where queries, then you can use a Where object to build up a query:
$where = new \Zend\Db\Sql\Where();
$where->addPredicate(
new \Zend\Db\Sql\Predicate\Like('some_field', '%'.$value.'%')
)
->OR->->equalTo('my_field', 'bob')
->AND->equalTo('my_field', 'hello');
$select->where($where);

Extjs 4 Grid findcolumn

I search a way in extjs 4 to find grid columns dynamic, because i wrote a function to show errors in editor grid. In version 3 i've made it over
getColumnModel().findColumnIndex(cellname);
but column model no longer exists, does anybody has an idea?
Regards
I just had to work this out, #VoidMan was close. Need to specify the view though. For example:
If your column is configured with an itemId like this:
{
header: 'A Column',
dataIndex: 'data',
width: 70,
itemId: 'myColumnItemId'
}
You can call it like this:
grid.getView().getHeaderCt().child('#myColumnItemId')
This is something among these lines:
myGrid.headerCt.child('#column')
where #column its your column itemId. Note, use itemId and not id because columns are now Component and Component id must be unique across all your application.
Hope that helps.
take a look at Ext.grid.header.Container and Ext.view.Table.headerCt