viewcriteria is not working for data having word "and" - oracle-adf

i am working with applying view criteria programaticlly, till now it was fine, but when i searched with "develop and unit test" it is showing 0 records even though my table having data. iam using like operator. could any one help on this .
i have one table, having option to filter by providing select combo box list of vales, for every column when i select any thing in lov in value change listener i am applying viewcriteria programatically on table vo.
note. every thing is programatic view object only there is no point of entity, or sql
Sample Code:
DCIteratorBinding bindIterator = ADFUtils.findIterator("Tri2EWS_ETKAPIData_VO1Iterator");//Table viewObject(programatic)
Tri2EWS_ETKAPIData_VOImpl voimpl = (Tri2EWS_ETKAPIData_VOImpl) bindIterator.getViewObject();
ViewCriteria viewCriteria = voimpl.createViewCriteria();
viewCriteria.setName("MyVc");
ViewCriteriaRow viewCriteriaRow = viewCriteria.createViewCriteriaRow();
viewCriteriaRow.setOperator("ViewAttr1", "LIKE");
viewCriteriaRow.setAttribute("ViewAttr1", "stack and OverFlow");
viewCriteria.add(viewCriteriaRow);
viewCriteria.setCriteriaMode(ViewCriteria.CRITERIA_MODE_CACHE);
voimpl.applyViewCriteria(viewCriteria, true);
voimpl.executeQuery();
voipmpl.getRowCount();//Getting 0 here (Actually i should get 1)

Turn on debug messages for ADF BC (jbo.debugoutput) so you can see the SQL that is being generated.
This will help you figure out if the query is correctly formatted.

Related

Displaying Parse Data to ContainerList

I want to display data from Parse in a list from GamesScores class using Container in Codename One, this is what I've tried so far and it's not showing anything nor giving any errors:
Container container = findListCont();
container.setLayout(BoxLayout.y());
container.setScrollableY(true);
ParseQuery<ParseObject> query = ParseQuery.getQuery("GameScore");
List<ParseObject> results = (List<ParseObject>) query.find();
System.out.println("Size: " + results.size());
container.addComponent(results, f);
Please help me out, I'm a new in Codename One. If there tutorials on it, please share or anything to help me achieve the desired results.
I'm actually shocked this isn't failing. You are using the add constraint to place the object result as a constraint and you add the form object into the container...
You need to loop over the results and convert them to components to add into the layout. It also seems that you are using the old GUI builder which I would recommend against.
Generally something like this rough pseudo code should work assuming you are using a box Y layout:
for(ParseObject o : results) {
MultiButton mb = new MultiButton(o.getDisplayValue());
f.add(mb);
}
f.revalidate();

Vb.Net DataView Search Issue In RowFilter

I am working with VB.Net and there is a scenario in application is that, we search from dataview by setting DataView.RowFilter = "some search text" property, we have a scenario in which there is an apostrophe sign (') in search string, we replace it with ['']. but this will never give result ever even the rowset containing [''] symbols in row set.
Further more I have played with the search criteria value like '%SearchText[%' , it says invalid pattern, I canot change the logic back in Application rather to fix it in StoredProcedure so it may find the best result.
Following is the Search Text = "Hello Kitty’s Friendship" and below are two rows in DataView Object.FormattedName = Column
Hello Kitty['']s Friendship Bouquet
Hello Kitty['']s Friendship Bouquet Mango
And Following is the code:
Dim strLocal As String = "FormattedName Like'%Hello Kitty['']s Friendship Bouq'%"
dvProducts.RowFilter = strLocal
FormattedNameis the column on which we apply search.
Somebody please suggest.

comboBox -- saving valueMember but showing displayMember

Just starting to use VS2013. Have several projects that I am porting from older technology. This should be really simple, so I am sure I am missing something easy.
The combo box is used to build a record. There is an ID field and a Description field. Very simple. I am trying to show the Description (which is text), but save the ID (which is int).
DataSource = table1BindingSource
DisplayMember = Description
ValueMember = ID
Databinding.Text = table2BindingSource.field1
I have tried setting
Databinding.SelectedValue = ID
and
Databinding.SelectedItem = ID
It displays in the dropdown correctly. It displays in the field correctly, using the Description. But value must not be associated with the field correctly, because I cannot save or move to the next record. Looks like the Description is getting put in the field1, and as it is int, it is not accepting it.
What am I missing?
I got it. For text boxes, I had been assigning
DataBinding.Text = Table1.field
So, I was trying to assign for combo boxes
DataSource = Table1
DisplayMember = Table1.description
ValueMember - Table1.code
and
DataBinding.SelectedValue = Table1.code
DataBinding.Text = Table2.field
I finally removed the Text statement and assigned
DataBinding.SelectedValue = Table2.field
And it all worked as desired.

How to select a row by default in af:table in Oracle ADF

I have a requirement in which I have an af:query panel which after querying populates an af:table.
Now based on the table rows when any 1 row is selected, the graphs below it should be populated based on some columns.
Now my problem is that on search when the table is populated for the first time, no row is selected.
I need the first row to be selected automatically. I have searched multiple solutions from the net forums but till now haven't found any working solution.
Please help me what code should I use to select a row programmatically. and also where should I put this code in the backing bean.
As you've correctly mentioned, at the first render of the table no row is selected. I've encountered this problem too, and i've dealt with it by calling a getting the first row of the corresponding VO on BeforePhase (i.e: on the page first rendering or refresh).
I understand that you intend to do so for the first searching.
The af:query component has a property called QueryListener. You can link it with a method inside a backing bean. The content should be like:
private QueryEvent qEvent = null;
public void queryListener(QueryEvent queryEvent) {
setQEvent(queryEvent);
JSFUtils.invokeMethodExpression("#{bindings.YourViewObjectNameViewCriteriaQuery.processQuery}", Object.class,
QueryEvent.class, getQEvent());
BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry(); //Edited
DCBindingContainer bc = (DCBindingContainer)bindings;
DCIteratorBinding iterator = bc.findIteratorBinding("YourViewObject1Iterator");
Row r = iterator.getCurrentRow(); //Here you've got the very first row, and can operate with it
.....
}
public void setQEvent(QueryEvent qEvent) {
this.qEvent = qEvent;
}
public QueryEvent getQEvent() {
return qEvent;
}
With this, you should be able to get the first row when the query is executed (i.e: when the search is done).
After getting the first row, you can programmatically the graph process execution or whatever you do.
NOTE: invokeMethodExpression can be found inside JSFUtils, which is a starndard class with static methods which source code you can download here: JSFUtils.java

One database to load data from through multiple tableviews

I've tried to get this app going but I don't know how to go about it. I have tried googling for days getting a good answer but to no avail. Therefor I turn to you.
I want to have a typical database (sql or core data) with all data collected. Then display first criteria in a tableview, pass data to next tableview, and in the third tableview display cells depending on the two choices made previously (like: where (x=1 & y=2) then display cells ). Finally get a detailview where I can load optional data from the database.
Any which way you can help or point me in any direction would be great.
//KeLLoGsX
RayWenderlich Tutorials has a number of tutorials that might apply.
More specifically, when a user selects a row in a view use the prepareForSegue method to set a property on the new view indicating the selection so you can taylor the new view accordingly. For example:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:#"editTemplate"]) {
[[segue destinationViewController] setManagedObjectContext:self.managedObjectContext];
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
self.selectedTemplate = [self.fetchedResultsController objectAtIndexPath:indexPath];
[[segue destinationViewController] setSelectedTemplate:self.selectedTemplate];
}
if ([[segue identifier] isEqualToString:#"returnToNotes"]) {
// do nothing special
}
}
The segue identifier like "editTemplte" are set in storyboard by selecting the segue and using the attributes inspector to name them.

Resources