JTable multi column sorting (jdk 1.5)
Hi,
Can you please send a short example (and/or a link) to multi column sorting using sun TableSorter class ?
Thanks a lot,
Ido
Read the Documentation that comes with the TableSorter class. I believe you use Shift+Click or Control+Click to sort multiple columns.
Similar Messages
-
SWT table widget and multi column sorting
Hello,
I want to make the standard SWT table widget support multi column sorting.
Searching on the web didn't lead to useful results. The Nebula project should be the last option.
I guess I need a comparator chain, but how do I realize aspects like let columns appear blue when marked or mark multiple columns by pressing shift key and left mouse button?
Any examples are much appreciated.
Thank you very much!
Regards,
MickHello,
I want to make the standard SWT table widget support multi column sorting.
Searching on the web didn't lead to useful results. The Nebula project should be the last option.
I guess I need a comparator chain, but how do I realize aspects like let columns appear blue when marked or mark multiple columns by pressing shift key and left mouse button?
Any examples are much appreciated.
Thank you very much!
Regards,
Mick -
I am wondering if it is possbile to sort data grids in multi
columns?? For example lets say the data grid simply looks like
this:
Name
Date
Art 10/29/06
Chris 12/02/04
Bob 02/21/07
Bo 08/08/05
And i want to sort it in abc order first then within that
sort(abc order) have does be sorted again by date so that A's will
stay together, B's and so on...Is this possible and if so how?
Thanks for all the helphere is what i have...it crashes after the first click....
rivate function ctrlCheck(ke:KeyboardEvent):void // checks to
see if the ctrl key is pressed to do a multicolumn sort.
if( ke.keyCode == 17) ctrlChecker =true;
else ctrlChecker = false;
private function resortColumns(le:ListEvent):void //if there
is more than one page of results resort the columns and requery,
else just resort
colSortedOn = new String("");
var sortDirection:String = new String("");
var s:Sort=new Sort();
var count:int=0;
var arr:Array=new Array();
if(le.rowIndex == 0)//get the column sorted on and attach
that to the query and requery
if(ctrlChecker==true)
while(ctrlChecker==true)//while the user is still holding
the ctrl key
colSortedOn =
DataGridColumn(datagrid1.columns[le.columnIndex]).dataField.toString();
if(DataGridColumn(datagrid1.columns[le.columnIndex]).sortDescending)
sortLoadDirection = true;
else
sortLoadDirection = false;
arr[count]=new SortField(colSortedOn, true,
sortLoadDirection)
count ++;
for(var i:int =0; i<arr.length; i++)
s.fields
=arr
datagrid1.dataProvider.sort= s;
datagrid1.dataProvider.refresh();
else //there is no sort order taking place, the item click
was something else entirely
parentDocument.sortCheck = 1;
} -
Multiple column sorting in JTable
There is way to release multiple column sorting in JTable.
ADF/SWing, Jdev 10.1.3I do not know that there is, but it would be really nice!
regards,
mario udina -
Multiple column sorting on JTable data
if any body can please send an example code how multiple column sorting can be done on table data.
condition:- one column should sort in ascending order another column in descending order.
am completly out of ideas it's urgent any help is greatly appritiated
Thank's in advance
sriI think the crosspost is because the OP was advised to post it in the Swing forum instead (it would've been nice to see the original post closed as well, though). Anyway...
Have you got your table sorting using one column? If so, how have you achieved that (eg, are you using Java 6)?
All you're after is a stable sorting algorithm so that any elements that are the same in the new sorting scheme stay in the same position relative to each other. Then you can just sort by "Column B" then "Column A" to achieve multiple column sorting. I believe that Collections.sort is stable and therefore any sorting approach based on that should be easily modifiable to do what you want.
Hope this helps. -
Interactive Report wide Column Sorting hangs in Internet Explorer
I have an application that contains an interactive report. The Column Sorting and Filtering functions work fine in Firefox. However, if I try to sort a wide (110 byte - it contains a hyperlink) column in Internet Explorer, APEX produces the 'loading data' image and then hangs. Even a sort of a narrow (3 byte) column is noticeably slower in Internet Explorer than in Firefox.
We are running APEX 3.1.1 on Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production with the Partitioning, OLAP, Data Mining and Real Application Testing optionsHello,
I answer you over your post.
Joe Bertram wrote:
Hi,
That's an interesting issue. What kind of images are these? Are they the default images installed or are they your custom set of images?The images are png files included as they were icons into the table.
>
You say the images disappear when you sort the report. Does it happen when you sort on demand in the dashboard or when you sort it in the report itself? Or both?Only when sort from the dashboard. From the report itself, the answers works fine.
>
What are your environment details?Server:
OBI 10.1.3.4.1.090414.1900
Windows 2003 server
JDK 1.6.0.17
Thin Client:
Internet explorer 8
>
Thanks for the extra info.
Best regards,
-JoeIt happens also in other two environments (Development and Pre-production) with the same SW architecture.
Thanks for your time. -
Customizing column sorting in new jsf table
The new JSF table in the creator 2 is great. I like it. It includes so many out of the box features. It is the reason we use the creator for our current project.
But I cannot figure out how to customize the column sorting.
Why do I need column sorting?
I need to sort a column that can include ad IP address or a host name. Our customer can either use a host name or an IP address to address a device in the network, both in the same column.
Now sorting an IP address is already difficult. It is actually a sort over a 4 byte number. Sorting over host names is normal alphabetic string sorting.
How to sort over both in the same column?
This cannot be done using standard sorting. I need to use a validator or something similar to customize the sorting of this column.
Can anybody help me with a hint if:
1- Customizing sorting over a column is possible. (I really would like to keep all other sorting features (icons, multi column support...)).
2- A hint or code sample, how to do this.
If this is not possible, I urge the creator team to think of implementing this soon. Otherwise one killer feature of the creator 2 will lose a lot of its teeth.Thx mayagiri for your reply!
But including the src-code for the dataprovider package into a test project, and debugging in the creator-ide has done the thing!
Here our solution:
Class ToCompare is the object type which address field displayed in a page, simply containing a table with 2 adress colums, that can be sorted either according to our ip/hostname-comparison or according to String.compare().
* ToCompare.java
* Created on 10. Februar 2006, 10:41
* This class is a basic model object,
* with a field - String address - according
* to which it shall be sortable.
package comparator;
* @author mock
public class ToCompare {
* holds the IP or Host address
private String address=null;
* Instance of a Comparator class that
* provides our sorting algorithm
private RcHostComparator hostComparator=null;
/** Creates a new instance of ToCompare */
public ToCompare() {
this("defaultHost");
* when creating a new ToCompare instance,
* the hostComparator is created for it
* @ param aAddress - IP or Hostname
public ToCompare(String aAddress) {
address=aAddress;
hostComparator=new RcHostComparator(address);
public String getAddress() {
return address;
public RcHostComparator getHostComparator() {
return hostComparator;
}Here the code of the Class RcHostComparator, it is created with the address field of the ToCompare object that it holds. It first checks if the address field is an IP or not, and then chooses the comparison algorithm according to its own field state and the field state of the object to compare to:
* RcHostComparator.java
* Created on 10. Februar 2006, 10:43
* This class is used to provide a method for
* comparing objects that have an address field,
* containing either IP adresses or hostnames.
package comparator;
import java.text.CollationKey;
import java.text.Collator;
import java.util.Comparator;
import java.util.Locale;
* @author mock
public class RcHostComparator implements Comparator
* holds the IP or Host address
private String address=null;
* Is the address an IP
private boolean isIPAddress=false;
* if (!isIPAddress) this is created out of the address
* to provide a performant way of comparing it with another
* CollationKey, in order to sort Strings localized
* @ see java.text.Collator
* @ see java.text.CollationKey
private CollationKey hostnameCollationKey=null;
* if (isIPAddress) this array holds
* the 4 byte of the Ip address to compare
private int[] intValues=null;
* minimum for IP bytes/ints
private static final int minIntValue=0;
* maximum for IP bytes/ints
private static final int maxIntValue=255;
* Creates a new instance of IpComparator
* @ param aAddress - holds the IP or Host address
public RcHostComparator(String aAddress) {
address=aAddress;
* check if address is an IP
isIPAddress=checkIP();
* if Hostname -> instantiate localized CollationKeys
if(!isIPAddress){
Collator _localeCollator=Collator.getInstance(Locale.getDefault());
hostnameCollationKey=_localeCollator.getCollationKey(address);
}else{}
* Here the comparison of the address fields is done.
* There a 4 cases:
* -1 both Hostnames
* -2 aObject1 IP, aObject2 Hostname
* -3 aObject1 Hostname, aObject2 IP
* -4 both IPs
* @ param aObject1, aObject2 - Comparator objects
public int compare(Object aObject1, Object aObject2)
int _result= 0;
if(aObject1 instanceof RcHostComparator && aObject2 instanceof RcHostComparator )
RcHostComparator _ipComparator1=(RcHostComparator)aObject1;
RcHostComparator _ipComparator2=(RcHostComparator)aObject2;
* Compare algorithms, according to address types
if(!_ipComparator1.isIPAddress()&&!_ipComparator2.isIPAddress()){
* If both addresses are Strings use collationKey.compareTo(Object o)
_result=_ipComparator1.getHostnameCollationKey().compareTo(_ipComparator2.getHostnameCollationKey());
}else{
* IPs are smaller than Strings -> aObject1 < aObject2
if(_ipComparator1.isIPAddress()&&!_ipComparator2.isIPAddress()){
_result=-1;
}else{
* IPs are smaller than Strings -> aObject1 > aObject2
if(!_ipComparator1.isIPAddress()){
_result=1;
}else{
int _intIndex=0;
int[] _int1=_ipComparator1.getIntValues();
int[] _int2=_ipComparator2.getIntValues();
* compare IP adresses per bytes
while(_result==0 && _intIndex<4){
if(_int1[_intIndex]>_int2[_intIndex]){
_result=1;
}else if(_int1[_intIndex]<_int2[_intIndex]){
_result=-1;
}else{}
_intIndex++;
}else{}
return _result;
* checks if the address field holds an IP or a hostname
* if (_isIP) fill intValues[] with IP bytes
* if (!isIP) create hostnameCollationKey
private boolean checkIP(){
boolean _isIP=false;
String[] _getInts=null;
* basic check for IP address pattern
* 4 digits also allowed, cause leading
* 0 stands for octet number ->
* 0172=122 ->
* 0172.0172.0172.0172 = 122.122.122.122
boolean _firstcheck=address.matches("[0-9]{1,4}\\.[0-9]{1,4}\\.[0-9]{1,4}\\.[0-9]{1,4}");
if(_firstcheck){
_getInts=address.split("\\.");
intValues=new int[4];
for (int _count=0; _count<4; _count++){
try{
int _toIntValue;
if(_getInts[_count].startsWith("0")){
// if leading 0 parse as octet -> radix=8
_toIntValue=Integer.parseInt(_getInts[_count], 8);
}else{
// parse as is -> radix=10 -> (optional)
_toIntValue=Integer.parseInt(_getInts[_count]);
if(_toIntValue<minIntValue||_toIntValue>maxIntValue){
// out of unsigned byte range -> no IP
return _isIP;
}else{
// inside byte range -> could be part of an IP
intValues[_count]=_toIntValue;
}catch(NumberFormatException e){
// not parseable -> no IP
return _isIP;
// all 4 bytes/ints are parseable and in unsigned byte range -> this is an IP
_isIP=true;
}else{}
return _isIP;
public boolean isIPAddress() {
return isIPAddress;
public int[] getIntValues() {
return intValues;
public CollationKey getHostnameCollationKey() {
return hostnameCollationKey;
public String getAddress()
return address;
}The page bean holds an array of ToCompare objects. It is the model for a new table component, hold by an ObjectArrayDataProvider. Here a code excerpt:
public class Page1 extends AbstractPageBean
private ToCompare[] toCompare= new ToCompare[]{
new ToCompare("1.1.1.1"),
new ToCompare("2.1.1.1"),
new ToCompare("9.1.1.1"),
new ToCompare("11.1.1.1"),
new ToCompare("0172.0172.0172.0172"),
new ToCompare("123.1.1.1"),
new ToCompare("a"),
new ToCompare("o"),
new ToCompare("u"),
new ToCompare("z"),
new ToCompare("�"),
new ToCompare("�"),
new ToCompare("�")
* This method is automatically generated, so any user-specified code inserted
* here is subject to being replaced
private void _init() throws Exception
objectArrayDataProvider1.setArray(toCompare);
private TableRowGroup tableRowGroup1 = new TableRowGroup();
private ObjectArrayDataProvider objectArrayDataProvider1 = new ObjectArrayDataProvider();
}The relevant .jsp section for the two column table looks like:
<ui:tableRowGroup binding="#{Page1.tableRowGroup1}" id="tableRowGroup1" rows="10" sourceData="#{Page1.objectArrayDataProvider1}" sourceVar="currentRow">
<ui:tableColumn binding="#{Page1.tableColumn1}" headerText="SortIP" id="tableColumn1" sort="#{currentRow.value['hostComparator']}">
<ui:staticText binding="#{Page1.staticText1}" id="staticText1" text="#{currentRow.value['address']}"/>
</ui:tableColumn>
<ui:tableColumn binding="#{Page1.tableColumn2}" headerText="SortString" id="tableColumn2" sort="address">
<ui:staticText binding="#{Page1.staticText2}" id="staticText2" text="#{currentRow.value['address']}"/>
</ui:tableColumn>
</ui:tableRowGroup>Sorting localized with Locale="DE_de" according to ip/hostcompare sorts:
SortIP
1.1.1.1
2.1.1.1
9.1.1.1
11.1.1.1
0172.0172.0172.0172
123.1.1.1
a
�
o
�
u
�
zWhereas normal sort over String address whitout localization sorts:
SortString
0172.0172.0172.0172
1.1.1.1
11.1.1.1
123.1.1.1
2.1.1.1
9.1.1.1
a
o
u
z
�
�
�Not that short, but I hope it will help - if anyone has the need for another than the default sorting algorithms
Best regards,
Hate E. Lee -
JTable - make column headers clickable
Hi all
I have a JTable, and now I want to sort by column. I've actually got the column sorting working using menu items, but how can I make my column header clickable, and where do I add an actionListener to?public void addMouseListenerToHeaderInTable(JTable table) {
final JTable tableView = table;
tableView.setColumnSelectionAllowed(false);
MouseAdapter listMouseListener = new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
TableColumnModel columnModel = tableView.getColumnModel();
int viewColumn = columnModel.getColumnIndexAtX(e.getX());
int column = tableView.convertColumnIndexToModel(viewColumn);
if (e.getClickCount() == 1 && column != -1) {
int shiftPressed = e.getModifiers() & InputEvent.SHIFT_MASK;
boolean ascending = (shiftPressed == 0);
// sort
JTableHeader th = tableView.getTableHeader();
th.addMouseListener(listMouseListener);
} -
Text query using a Multi Column datastore index slow
I have created a text index using multi column datastore preference. I have specified two clob columns in my preference. Searching on this new index works, but it is slower than I expected.
I have done the following comparison:
My original two clob columns are: DocumentBody and DocumentFields. I have built an individual text index on each column. My new column with Multi Column index is DocumentBodyAndFields;
I did two queries:
1. search 'dog' on DocumentBody UNION search 'dog' on DocumentFields;
2. search 'dog' on DocumentBodyAndFields;
I would think the second search should be faster than the first one because it is a single query. But this is not the case. The second query is consistently slower than the first query by about 10-20%.
Things are getting much worse when I search on preceding wildcards. If I search '%job', the multi column index is twice as slow as the first query! I am very confused by this result. Is this a bug?I am unable to reproduce the performance problem. In my tests, the search that uses the multicolumn_datastore performs better, as demonstrated below. Can you provide a similar test case that shows the table structure, datastore, index creations, and explain plan?
SCOTT@orcl_11g> CREATE TABLE your_tab
2 (DocumentId NUMBER,
3 DocumentBody CLOB,
4 DocumentFields CLOB,
5 DocumentBodyAndFields VARCHAR2 (1))
6 /
Table created.
SCOTT@orcl_11g> INSERT ALL
2 INTO your_tab VALUES (-1, 'adog', 'bdog', NULL)
3 INTO your_tab VALUES (-2, 'adog', 'whatever', NULL)
4 INTO your_tab VALUES (-3, 'whatever', 'bdog', NULL)
5 SELECT * FROM DUAL
6 /
3 rows created.
SCOTT@orcl_11g> INSERT INTO your_tab
2 SELECT object_id, object_name, object_name, NULL
3 FROM all_objects
4 /
69063 rows created.
SCOTT@orcl_11g> BEGIN
2 CTX_DDL.CREATE_PREFERENCE
3 ('your_datastore', 'MULTI_COLUMN_DATASTORE');
4 CTX_DDL.SET_ATTRIBUTE
5 ('your_datastore', 'COLUMNS', 'DocumentBody, DocumentFields');
6 END;
7 /
PL/SQL procedure successfully completed.
SCOTT@orcl_11g> CREATE INDEX your_idx1 ON your_tab (DocumentBody)
2 INDEXTYPE IS CTXSYS.CONTEXT
3 /
Index created.
SCOTT@orcl_11g> CREATE INDEX your_idx2 ON your_tab (DocumentFields)
2 INDEXTYPE IS CTXSYS.CONTEXT
3 /
Index created.
SCOTT@orcl_11g> CREATE INDEX your_idx3 ON your_tab (DocumentBodyAndFields)
2 INDEXTYPE IS CTXSYS.CONTEXT
3 PARAMETERS ('DATASTORE your_datastore')
4 /
Index created.
SCOTT@orcl_11g> EXEC DBMS_STATS.GATHER_TABLE_STATS (USER, 'YOUR_TAB')
PL/SQL procedure successfully completed.
SCOTT@orcl_11g> SET TIMING ON
SCOTT@orcl_11g> SET AUTOTRACE ON EXPLAIN
SCOTT@orcl_11g> SELECT DocumentId FROM your_tab
2 WHERE CONTAINS (DocumentBody, '%dog') > 0
3 UNION
4 SELECT DocumentId FROM your_tab
5 WHERE CONTAINS (DocumentFields, '%dog') > 0
6 /
DOCUMENTID
-3
-2
-1
Elapsed: 00:00:00.65
Execution Plan
Plan hash value: 4118340734
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 4 | 576 | 2 (100)| 00:00:01 |
| 1 | SORT UNIQUE | | 4 | 576 | 2 (100)| 00:00:01 |
| 2 | UNION-ALL | | | | | |
| 3 | TABLE ACCESS BY INDEX ROWID| YOUR_TAB | 2 | 288 | 0 (0)| 00:00:01 |
|* 4 | DOMAIN INDEX | YOUR_IDX1 | | | 0 (0)| 00:00:01 |
| 5 | TABLE ACCESS BY INDEX ROWID| YOUR_TAB | 2 | 288 | 0 (0)| 00:00:01 |
|* 6 | DOMAIN INDEX | YOUR_IDX2 | | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
4 - access("CTXSYS"."CONTAINS"("DOCUMENTBODY",'%dog')>0)
6 - access("CTXSYS"."CONTAINS"("DOCUMENTFIELDS",'%dog')>0)
SCOTT@orcl_11g> SELECT DocumentId FROM your_tab
2 WHERE CONTAINS (DocumentBodyAndFields, '%dog') > 0
3 /
DOCUMENTID
-1
-2
-3
Elapsed: 00:00:00.28
Execution Plan
Plan hash value: 65113709
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 4 | 76 | 0 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| YOUR_TAB | 4 | 76 | 0 (0)| 00:00:01 |
|* 2 | DOMAIN INDEX | YOUR_IDX3 | | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - access("CTXSYS"."CONTAINS"("DOCUMENTBODYANDFIELDS",'%dog')>0)
SCOTT@orcl_11g> -
I am using the Crystal Reports edition bundled with Visual Studio 2005. I have a problem with a multi-column report. It is a two column member directory with family members. It lists the member name, contact info, spouse, and children. I want each family group to stay together, and not break cross a column or a page. Each group may have from 3 to a dozen or so lines.
The family groups will not break across a page (which is good), but they will break across a column (bad). I have tried many combinations of settings to make this work without success.
So I wonder if anyone has seen and resolved this problem, or if perhaps it works better in the full version of Crystal.In some sub-sections, I have checked 'Suppress Blank Section' checked. In others, I have a suppression formula.
Each section has only a single field.
The record set that the report uses has a single row for each person. The sorting and grouping is arranged so that the first record in each family group is the 'main' member. The report displays this person's name, and also shows the sections which include address and phone number info. Subsequent records are for family members (spouse and/or children). For these records, I display the name, but suppress the address and phone sections.
There is also a detail sub-section used as a group header. This group breaks when the first letter of the last name changes, so it an display a single letter heading ("A"). I had tried this as a regular group header too, but it didn't help.
I have tried combining all the sections into a single one with each field on a separate line (which means the section can have some blank space), and also combined into a text box. No luck.
I also have the group itself set to "Keep Together' in the group expert. Doesn't help/ -
JTable Multi-Span Cell Example
Searched the Forum und Google for the "JTable Multi-Span Cell Example" and always found this Link :
http://www2.gol.com/users/tame/swing/examples/SwingExamples.html
But the Examples are only working with JDK 1.3.1, JDK 1.4.1 and JDK 1.4.2 aren`t working anymore.
What do i have to change, or are there any new examples for Multi-Span Cells in the JTable provided by SUN ?In AttributiveTableCellModel.java, rewrite the following function:
public void setDataVector(Vector newData, Vector columnNames) {
if (newData == null)
throw new IllegalArgumentException("setDataVector() - Null parameter");
dataVector = new Vector(0);
setColumnIdentifiers(columnNames);
dataVector = newData;
super.setDataVector(newData, columnNames);
cellAtt = new DefaultCellAttribute(newData.size(),
columnIdentifiers.size());
newRowsAdded(new TableModelEvent(this, 0, getRowCount()-1,
TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT));
} -
How do i create a Multi column Dynamic list using Swing?
Hi,
I need to be able to do a file search (in a separate thread) on the hard drive and display the results in a multi column List control .
Jtable seems to be rather 'static'y. i.e load data in once. and maybe reload it again later. But i need to load one row in at a time as the search progresses.
Also any row can be deleted or moved to another position.
CListCtrl in MFC allows me to do this handily.
But Is there a way to do this using Swing?
havent seen anything that says JList can do this.
TIAHi Jacob.
I would use JTable for that. I did not exactly understand what you meant by JTable being "static"y.
Anyway, I would have the thread update the data in the tablemodel behind the table and invoke "fireTableRowsInserted" (may be after every insert or after inserting a chunk of rows). I had a sample something similar to what you are working on. Let me know if you need the sample.
HTH.
Regards,
Vijay -
Unable to capture the adf table column sort icons using open script tool
Hi All,
I am new to OATS and I am trying to create script for testing ADF application using open script tool. I face issues in recording two events.
1. I am unable to record the event of clicking adf table column sort icons that exist on the column header. I tried to use the capture tool, but that couldn't help me.
2. The second issue is I am unable to capture the panel header text. The component can be identified but I was not able to identify the supporting attribute for the header text.Hi keerthi,
1. I have pasted the code for the first issue
web
.button(
122,
"/web:window[@index='0' or @title='Manage Network Targets - Oracle Communications Order and Service Management - Order and Service Management']/web:document[@index='0' or @name='1824fhkchs_6']/web:form[@id='pt1:_UISform1' or @name='pt1:_UISform1' or @index='0']/web:button[@id='pt1:MA:0:n1:1:pt1:qryId1::search' or @value='Search' or @index='3']")
.click();
adf
.table(
"/web:window[@index='0' or @title='Manage Network Targets - Oracle Communications Order and Service Management - Order and Service Management']/web:document[@index='0' or @name='1c9nk1ryzv_6']/web:ADFTable[@absoluteLocator='pt1:MA:n1:pt1:pnlcltn:resId1']")
.columnSort("Ascending", "Name" );
} -
Multi-column BITMAP index vs. multiple BITMAP indices?
Given the table (simple, made-up example):
CREATE TABLE applicant_diversity_info (
applicant_diversity_id NUMBER(12), PRIMARY KEY(applicant_diversity_id),
apply_date DATE,
ssn_salted_md5 RAW(16),
gender CHAR(1), CHECK ( (gender IS NULL OR gender IN ('M','F')) ),
racial_continent VARCHAR2(30), CHECK ( (racial_continent IS NULL
OR racial_continent IN ('Europe','Africa','America','Asia_Pacific')) ),
ethnic_supergroup VARCHAR2(30), CHECK ( (ethnic_supergroup IS NULL OR ethnic_supergroup IN ('Latin American','Other')) ),
hire_salary NUMBER(11,2),
hire_month DATE,
termination_salary NUMBER(11,2),
termination_month DATE,
termination_cause VARCHAR2(30), CHECK ( (termination_cause IS NULL
OR termination_cause IN ('Resigned','Leave of Absence','Laid Off','Performance','Cause')) )
Oracle (syntactically) allows me to create either one BITMAP index over all four small-cardinality columns
CREATE BITMAP INDEX applicant_diversity_diversity_idx ON applicant_diversity_info (
gender, racial_continent, ethnic_supergroup, termination_reason );
or four independent indexes
CREATE BITMAP INDEX applicant_diversity_gender_idx ON applicant_diversity_info ( gender );
CREATE BITMAP INDEX applicant_diversity_race_idx ON applicant_diversity_info ( raceial_continent );
etc.
What is the difference between the two approaches; is there any meaningful difference in disk-space between the one multi-colum index and the four single-column indexes? Does it make a difference in what the query-planner will consider?
And, if I define one multi-column BITMAP index, does the order of columns matter?>
What is the difference between the two approaches; is there any meaningful difference in disk-space between the one multi-colum index and the four single-column indexes? Does it make a difference in what the query-planner will consider?
And, if I define one multi-column BITMAP index, does the order of columns matter?
>
You may want to read this two-part blog, that answers that exact question, by recognized expert Richard Foote
http://richardfoote.wordpress.com/2010/05/06/concatenated-bitmap-indexes-part-i-two-of-us/
http://richardfoote.wordpress.com/2010/05/12/concatenated-bitmap-indexes-part-ii-everybodys-got-to-learn-sometime/
As with many things Oracle the answer is 'it depends'.
In short the same considerations apply for a concatenated index whether it is bitmap or b-tree: 1) will the leading column usually be in the predicate and 2) will most or all of the index columns be specified in the queries.
Here are some quotes from part 1
>
Many of the same issues and factors in deciding to create a single, multi-column index vs. several, single column indexes apply to Bitmap indexes as they do with B-Tree indexes, although there are a number of key differences to consider as well.
Another thing to note regarding a concatenated Bitmap index is that the potential number of index entries is a product of distinct combinations of data of the indexed columns.
A concatenated Bitmap index can potentially use less or more space than corresponding single column indexes, it depends on the number of index entries that are derived and the distribution of the data with the table.
>
Here is the lead quote from part 2
>
The issues regarding whether to go for single column indexes vs. concatenated indexes are similar for Bitmap indexes as they are for B-Tree indexes.
It’s generally more efficient to access a concatenated index as it’s only the one index with less processing and less throwaway rowids/rows to contend with. However it’s more flexible to have single column indexes, especially for Bitmap indexes that are kinda designed to be used concurrently, as concatenated indexes are heavily dependant on the leading column being known in queries. -
How Can I get multi column values from dynamic search help?
Hi Gurus;
I'm using dynamic search help in my program.
I want to get multi column values from search help. But I dont know solution for this issue.
I'm using F4IF_INT_TABLE_VALUE_REQUEST FM.
How Can I get multi column values from dynamic search help?
Thanks.Believe it or not, the same FM worked for me in a dynpro. I will try to explain here how it works in custom screen and then you can do your work for other screens or program types. I am not going to write my actual work but will explain in general.
I have 4 fields (FLD1, FLD2, FLD3, FLD4) and i made the search based on FLD2 and when user click on a line (could be any field), then this would bring the line on to the screens.
There are like 3 steps.
You have your value_tab for my fields FLD1, FLD2, FLD3 and FLD4. This is just the data that we pass into the FM. (data: IT_VALTAB type table of ZVAL_TABLE)
Next map the screen fields into an internal table (data: It_dynpfld type table of dselc ). I also have other internal tables defined (just to keep it straight, i will be putting here) data: It_return type standard table of ddshretval.
Next step is to call the function module. Make sure you have values in IT_VALTAB.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'FLD2'
value_org = 'S'
tables
value_tab = It_VALTAB
return_tab = It_return
dynpfld_mapping = It_dynpfld
exceptions
parameter_error = 1
no_values_found = 2
others = 3.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
else.
perform get_selected_fields tables It_return.
endif.
The code within the perform GET_SELECTED_FIELDS - We need to map the result fields after user selects it. The code goes like this. This is step is to update the dynpro fields.
I need a internal table as well as a work area here. like,
data: lt_fields type table of dynpread,
la_fields type dynpread.
field-symbols: <fs_return> type ddshretval.
so fill out LT_FIELDS from the IT_RETURN table
loop at lt_return assigning <fs_return>.
la_fields-fieldname = <fs_return>-retfield.
la_fields-fieldvalue = <fs_return>-fieldval.
append la_fields to lt_fields.
clear: la_fields.
endloop.
Call the FM to update the dynpro
call function 'DYNP_VALUES_UPDATE'
exporting
dyname = sy-repid
dynumb = '1002' "This is my screen number. You could use 1000 for selection screen (hope so)
tables
dynpfields = lt_fields
exceptions
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
undefind_error = 7
others = 8.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
good luck
Maybe you are looking for
-
Help me in choosing..
hello I want to make my listening better now. I am completely unaware of these soundcard speaker things. I am using 2 tiny desktop speakers that came with my HCL pc 5years ago. So i want to make an upgrade for my ears. The thing is that i am not BCA(
-
How do you move them to the Phone memory? I have pics and vids I'd like to save from my old phone and can't , for the life of me, figure out how to movw them off of the SD card and onto the phone. Either all at once or individually. Then I can move t
-
How can I deternmine what apps are running on my Mac Book Pro
Hoe can I determine what applications I have open and running on my Mac Book Pro
-
How to get the methods of current class and its super class using reflection. The retrieved methods should be only the methods of user-defined classes but not methods of Java APIs such as Object or any other class provided in JDK. For ex, If Class B
-
iMac Mavericks Why can't I move folders around on my iMac hard drive? They just pop right back in place. I've selected Sort By None. This just started happening this morning so I must have done something! Any help?