I need to count gender column using conditions like state ,male,female, prefercources. how to write query in spring?I know to fetch data from data base using mapper class but here i only need to count .please help me. thanks in advance.
Related
Can anyone tell me which method to put a Query Range into for a class which is batchable?
I have a sample batch class, which runs fine. It retrieves all the records in the Sales Table. I know that I need to add a QueryBuildRange object somewhere, then set the value of the range to a particular value (e.g. Sales ID = 00123456), but I'm not sure what method to put it in (main? Run? QueryRun? InitQuery?)
Thanks for your help!
It depends on what you're wanting to do, but in AX 2009 for batch, you can look at InventCountCreate_Base for an example of how Microsoft does it.
Specifically these two methods:
\Classes\InventCountCreate_Base\new
\Classes\InventCountCreate_Base\initQueryRun
Microsoft does it several different ways. You can see an alternative method in WMSShipmentReservationBatch in these two methods:
\Classes\WMSShipmentReservationBatch\main
\Classes\WMSShipmentReservationBatch\buildQueryRun
Is there a way to filter table columns data as there is a way in excel to filter.
Filtering manually require a very long code if data is huge. So trying to find an easy way. Please suggest something.
I went through the following link for the same but need an easier and efficient approach.
http://code.makery.ch/blog/javafx-8-tableview-sorting-filtering/
There's no built-in filter capability for TableViews like Excel.
I've written a library that provides the GUI filters, but you'll still need to programmatically apply the results to filter your dataset:
https://code.google.com/p/javafx-filterable-table-columns/
https://github.com/jhsheets/javafx-filterable-table-columns
I wrote an extension for that use case:
https://github.com/maimArt/TableFilterFX
The implementation of the filter is quite easy. You wrap your TableView with the TableFilter and add the columns that should be filterd by tableFilter.filterColumn(TableColumn column)
1 Build your TableView like usual by code or fxml
TableView<Pojo> table = new TableView<>();
table.getItems().addAll(pojoList);
TableColumn<Pojo, String> columnA = new TableColumn<>("ColA");
TableColumn<Pojo, String> columnB = new TableColumn<>("ColB");
table.getColumns().add(columnA);
table.getColumns().add(columnB);
2 After that apply the filter
TableFilter<Pojo> tableFilter = new TableFilter<>(table);
tableFilter.filterColumn(columnA);
tableFilter.filterColumn(columnB);
I have an table view showed
part description, quantity, price
And I have a Model/View using this code
model = new QSqlRelationalTableModel(this);
model->setTable("parts");
model->setRelation(3,QSqlRelation("part_tbl","part_id","part_desc"));
model->select();
ui->tableView->setModel(model);
I need to add a new column that shows quantity * price in the table view. It's important to know I'm using QsqlRelationalTableModel
Help is appreciated, Thanks in advance
I think your best bet for handling this is to make either a model that inherits QSqlRelationalTableModel, or one that acts as a proxy (and contains a member for the model). Your new model will add the extra column, and when the data is requested for that column, use the data from the other columns to compute what is required.
I have created new LeaveMaster table in Axapta. please let me know how can i create number sequence of LeaveID. please help me. Thank you.
There's an article on MSDN that explains how to create your own custom number sequence. If you want to use an existing number sequence, use the NumberSeq class by calling NumberSeq::newGetNum() or NumberSeq::newGetNumFromCode().
I'm using Drupal's Views 2, and need to retrieve min values from fields in a custom table. The query for this is easy if I were writing it by hand--something like, "SELECT foo, min(bar) FROM table GROUP BY foo." But how would I do this using Views? I've already defined the table in a views.info file, so there's no trouble getting views to see the table. It's the Min() part of the query I just don't understand. My next stop will be the Views API documentation, but if someone can just provide the outline for how to do this quickly, I would greatly appreciate it.
New answer to an old question, but something like this will work. You need to create a custom field handler and then wrap the field as follows:
class views_handler_custom_field extends views_handler_field {
function query() {
$this->ensure_my_table();
$this->field_alias = $this->query->add_field("MAX({$this->table_alias}", "{$this->real_field})",$this->table_alias . "_" . $this->real_field);
}
}
Use aggregation from advanced configuration of views. After this is set
yes you can select max, min or any other selector to fields.
Test your results but it should work well
Alternatively in some cases you can sort your data ascending or
descending and then just pick one to be shown on the view. Can be
problematic when displaying multiple fields or so.
After testing first one seems to be faster at least on small scale.
One could consider the modules groupby and views_calc, but I assume they are not acceptable for you.
Additionally, you can accomplish this with a custom module.