Filter KeywordFilterField customized for the tabular data model

I am currently looking for the rows in the table that is filtered through the KeywordFilterField. The underlying data are in table form:

Contact {name, phone, etc etc}

The KeywordFilterField shows only what I pass to it (Contact.Name) by calling setSourceList() and filters that the channels in the list. So if I get the numbers, which will return a list empty, because none of the Contacts have numbers in their names.

However, what I want to do is query the table, like a SQL query, retrieve lines that correspond to a part of Contact.Name or Contact.Phone. (Remember this application don't use SQLite.) I'm using RMS to persistent storage and I created my database and queries of base by hand.)

Is there a way I could customize/override the filter query so that the KeywordFilterField calls my query functions rather than it's default filter String? It is a base with search CRUD application. I use KeywordFilterField because it's everything I need.

Any help would be useful.

It is possible with a text field and a list field, this way you can make your own personalized search for the keyword filter field does not search your data the way you want. In addition, I know that the keyword filter field is broken and that it was returning always completely incorrect search result for me.

Here's an overview of what to do. Some things I can't tell you how for example to what is happening in the function "searchContacts" since it is up to you to write the code to do whatever custom search you want.

class CustomKeywordFilterScreen extends MainScreen implements FieldChangeListener, ListFieldCallback
{
    //just a slightly modified edit field for use in entering keywords
    private CustomKeywordField _filterEdit;
    //a standard list field
    private ListField _countryList;

    //temp variable to hold the last keyword searched so we don't search for it again
    //you'll see this used later on
    private String _previousFilterValue;

    //any other private vars you need to hold search results go here
    //we'll use an a Contact[] for illustration
    private Contact[] _contactResults;

    CustomKeywordFilterScreen()
    {
        super(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR);

        //initiaize to empty string
        _previousFilterValue = "";

        //searchContacts is whatever function you write to do the customized search you want,
    //in this example passing an empty string returns all contacts
        _contactResults = searchContacts(_previousFilterValue);

        //create the edit field and set it as the title of the screen so it's always visible,
    //even when you scroll the list
        _filterEdit = new CustomKeywordField();
        _filterEdit.setLabel("Search: ");
        _filterEdit.setChangeListener(this);
        setTitle(_filterEdit);

        //create the list for showing results
        _contactList = new ListField();
        _countryList.setRowHeight(-2);
        _contactList.setSize(_contactResults.length);
        _contactList.setCallback(this);
        add(_contactList);
    }

    protected boolean keyChar(char c, int status, int time)
    {
        if (c == Characters.ESCAPE)
        {
        //user pressed escape key, if there's something in the edit field clear it
        //otherwise handle it as closing the screen or whatever else you want
            if (_filterEdit.getTextLength() > 0)
            {
                _filterEdit.setText("");
            }
            else
            {
                //close the screen or do something else, it's your call
                //maybe even do nothing, whatever you want
            }
            return (true);
        }
        else
        {
        //all other keystrokes set focus on the edit field
            _filterEdit.setFocus();
        }
        return (super.keyChar(c, status, time));
    }

    public void fieldChanged(Field field, int context)
    {
        if (field == _filterEdit)
        {
        //test the edit field's value against the previously searched value
        //if NOT the same then do a search and refresh results
            if (!_filterEdit.getText().equals(_previousFilterValue))
            {
            //cache the newest search keyword string
                _previousFilterValue = _filterEdit.getText();

                //search your data
                _contactResults = searchContacts(_previousFilterValue);
        //update the list size to cause it to redraw
                _contactList.setSize(_contactResults.length);
            }
        }
    }

    public void drawListRow(ListField listField, Graphics graphics, int index, int y, int width)
    {
        if (listField == _contactList && index > -1 && index < _contactResults.length)
        {
            //draw your list field row as you want it to appear
        }
    }

    public Object get(ListField listField, int index)
    {
        if (listField == _contactList && index > -1 && index < _contactResults.length)
        {
            return (_contactResults[index]);
        }
        return (null);
    }

    public int getPreferredWidth(ListField listField)
    {
        return (Display.getWidth());
    }

    public int indexOfList(ListField listField, String prefix, int start)
    {
        return (-1);
    }
}
class CustomKeywordField extends EditField
{
    CustomKeywordField()
    {
        super(USE_ALL_WIDTH | NO_LEARNING | NO_NEWLINE);
    }

    protected void paint(Graphics graphics)
    {
        super.paint(graphics);

        //Draw caret so the edit field always shows a cursor giving the user an indication they can type at anytime,
    //even when the focus is on the list field that is used in conjunction with this edit field to create a
    //keyword filter field replacement
        getFocusRect(new XYRect());
        drawFocus(graphics, true);
    }
}

Tags: BlackBerry Developers

Similar Questions

  • The Siebel data model with attribute mapping rule OPA?

    Hello

    Someone at - it has mapped siebel attribute of data model with the attribute rulefiles (rule of word doc file) (for example, p1, p2, p3... generated automatically)?

    I imported the siebel data model in OPM version 10.2. He created siebeldatmodel.xsrc file. all siebel attribute created with ID, model ID with the same name as the name attribute of siebel. but in the rulebook, we attributte with p1, p2, p3... names etc.

    The problem I am facing at I'm not able to map the attribute siebel generated with attribute (p1, p2, p3) rule book

    Any quick suggestions of experts will be very apperciable.


    Thank you

    There are a few simple rules for text attributes.

    1. unless the attribute belongs to the global level, the attribute must have the text of the entity included in its text. Thus, if the attribute belongs to the 'contact' it must understand that in its text. The possible options are:

    "* the contact work country."

    "the country of work of * the * contact."

    2. you cannot have two attributes with the same public name or the same text. So, you will get an error if you have two attributes with the same text "the country of work.

    Published by: frank.hampshire on July 27, 2011 13:50

    Published by: frank.hampshire on July 27, 2011 13:50

  • Can not see all the stored procedures in the Entity Data Model Wizard

    I hope it is a simple oversight on my part I try to use the new beta version of odp.net with entity framework support. I can open the Entity Data Model Wizard, give him my information database, and I can choose various tables to use successfully. But in the list where I select the tables, views and stored procedures, the wizard does not see my stored procs or my point of view.

    Does anyone know why he would see the tables but not views or stored procedures? My procs can be found under "packages" If that makes a difference. I tried to create a fictional stored procedure at the level above the title of 'procedures', but it is unclear whether.

    Is it possible for me to debug this from here? The log files, I could watch that would help me?

    Thank you
    Jim

    I belive your Oracle database 10 g such as 9iR2 predates.
    ODP/EF Beta does not list the stored procedures or functions when connect you to a database Oracle 10 g before.

    Readme.txt:
    4. the procedures are not compatible with the DB 9.2.
    Thus, there is no stored procedure listed by the EDM Wizard for 9.2 DBs.

  • Returns a route with the network data model

    Hi all,

    I like to read (on Chapter 11 of "Pro Oracle Spatial for Oracle Database 11g" manual) is it possible to receive the direction of travel of the computation of the path more runs using the routing engine.

    I want to ask you: is possible to receive the sense of the market by using the network data model? (for example, by using the Java API).

    Thank you in advance.

    Hello

    NDM API manages only the paths to the topological level. i.e. path of nodes and links. It generates no routes since the paths.
    You must use information Street links to generate driving directions yourself. You may need to use the sign post information as well as information geometry (towers from left to right) for directions.

    You can also use (API XML that uses the NDM API as its scan engine!) of the motor routing service Oracle to generate your itineraries which will include directions.

    Jack

  • Roads divided into the network data model

    Hello world

    I have a network model which consists of tables for the links and nodes of the city. The problem I have is that the links / roads are divided roads and some are not. As it is a partition in the middle to separate the road as on motorways and main roads.
    I can't seem to understand how the network data model which roads are divided and which are not. Also driving is supposed to be on the left side of the road.
    Please help and give your opinion,

    Thank you and best regards,
    Avinash

    Published by: avibooks on Sep 17, 2008 18:26

    Avinash,
    The function that you used in MapViewer is only for demonstration purposes. It does not contain the complete modeling and analysis of the model of network Spatial Oracle database functionality.
    I'm going to recommend that you use the Oracle Spatial NDM Java API (manual) instead.
    A workaround, you can try is to treat the physical barrier information yourself.
    As stated in my 1st approach, store this information in the table of links,.
    issuance of a JDBC query to the links table and check whether the link at the end of the path contains physical barriers.

    -Jack

  • Recommendations for the best 3D modeling App / program?

    Does anyone have a recommendation for the best 3D modeling application / program?

    (More for the creative rather than animation games and computer work)

    Thank you

    Hello

    I love Autodesk Inventor, but you need to use BOOTCAMP or VMWare/Parallels to run it because it only works with Windows.

    See you soon,.

    Adam

  • Creating a custom for the current scale

    Hi guys,.

    I need help in the creation of a custom scale. I read motor current (analog I / P) and I want to show that on a chart and write it to a file. I need to use a linear scaling for custom scale. The slope is 2 and the intersection point is 0. I have attached the code to clearly indicate what I'm currently building. The way I put up right now, it's not the scaling. It has 2 spots in the code. I would like to create a custom for the first task, as in the attached code scale. I had a scale customized using VI to Express DAQ Assistant. But I do not see these options when I try to do the same with the DAQmx task. Please let me know how this can be done. Any help is greatly appreciated.

    Thank you

    REDA

    Ah.

    on the pallate DAQmx > advanced > the balance settings

    There is a scale property node and "Create Scale.vi"

  • Need to create a structure for the target data store?

    Hi Experts,

    If I create a structure for the target data store, and then load the data from source to target works fine. If I make mistakes.

    Is necessary to create a structure for target?

    Please help me...

    Thanks in advance.

    A.Kavya.

    I found the answer. No need to create the structure for target temporary data store. and we need to create the structure for the permanent target data store.

  • Need to retrieve the data for the current date.

    Hello

    I have a table which then retrieves information when using this command.

    Select ta_acct, shift, created_on track_alerts;

    Technicolor A 24 March 14

    Technicolor A 24 March 14

    Technicolor A 24 March 14

    Technicolor A 24 March 14

    Manitoba telecom a 24 March 14 system

    Technicolor A 24 March 14

    I used this statement to retrieve the data for the given date.

    Select ta_acct, shift, created_on track_alerts where created_on = 24 March 14 ';

    Its not data recovery.

    Need help.

    Kind regards

    Prasad K T,.

    984002170

    Prasad K T wrote:

    Yes the created data type is date.

    CREATED_ON DATE

    Partha thanks it works now.

    Select ta_acct, shift, created_on in track_alerts where to move is: Shift and TRUNC (created_on) = TO_DATE('24-MAR-2014','DD-MON-YYYY');

    Still, I made a small change to my querry.

    Select ta_acct, shift, created_on track_alerts where to move is: shft and TRUNC (created_on) = TO_DATE (select double sysdate,'MON-DD-YYYY "");

    For this statement, it does not work.

    of course not...

    first: sysdate returns a date so no need of conversion here

    and

    second SYSDATE includes time, so your application should look like this:

    Select ta_acct, shift, created_on in track_alerts where to move is: Shift and TRUNC (created_on) = trunc (sysdate)

    or

    Select ta_acct, shift, created_on in track_alerts where to move is: shft and created_on > = trunc (sysdate) and created_on<>

    HTH

  • The number of heartbeat for the host data warehouses is 0, which is less than required: 2

    Hello

    I have trouble creating my DRS cluster + storage of DRS, I have 3 hosts esxi 5.1 for the task

    First, I created the cluster, no problem with that, so the DRS storage was created and now I can see in the Summary tab

    "The number of heartbeat for the host data warehouses is 0, which is less than required: 2".

    I search the Web and there are similar problems when people has only a single data store (the one that came with ESXi) and need to add another but in my case... vcenter detects any...

    In the views of storage I see the store of data (VMFS) but for some strange reason the cluster not

    In order to achieve data warehouses minimum (2) can I create an NFS and map it in THE 3 esxi hosts? Vcenter which consider a play config?

    Thank you

    You probably only have local data warehouses, which are not that HA would require for this feature (pulsations datastore) to work properly.

    You will need either 2 iSCSI, FC 2 or 2 NFS volumes... Or a combination of the any of them, for this feature to work. If you don't want to use this feature, you can also turn it off:

    http://www.yellow-bricks.com/2012/04/05/the-number-of-vSphere-HA-heartbeat-datastores-for-this-host-is-1-which-is-less-than-required-2/

  • Could not add the instance VO in the AM data model

    Jdev version: 11.1.2.4

    Steps to follow:

    (1) created a VO based on the SQL query.

    (2) when you try to add the VO instance in the AM data model, "Add an Instance" arrow (right arrow) is disabled.

    Please advise.

    Found resolution - Metalink Note 1530486.1.

  • Difference in the number of records for the same date - 11 GR 2

    Guy - 11 GR on Windows2005 2, 64-bit.

    BILLING_RECORD_KPN_ESP - is a monthly partitioned table.
    BILLING_RECORD_IDX #DATE - is a local index on "charge_date" in the table above.

    SQL > select / * + index (BILLING_RECORD_KPN_ESP BILLING_RECORD_IDX #DATE) * /.
    2 (trunc (CHARGE_DATE)) CHARGE_DATE;
    3 count (1) Record_count
    4. IN "RATOR_CDR". "" BILLING_RECORD_KPN_ESP ".
    where the 5 CHARGE_DATE = January 20, 2013.
    Group 6 by trunc (CHARGE_DATE)
    5 m

    CHARGE_DATE RECORD_COUNT
    ------------------ ------------
    2401 20 January 13-> > some records here.

    -> > Here I can see only '2041' records for Jan/20. But in the query below, it shows "192610" for the same date.

    Why is this difference in the number of records?

    SQL > select / * + index (BILLING_RECORD_KPN_ESP BILLING_RECORD_IDX #DATE) * /.
    (trunc (CHARGE_DATE)) CHARGE_DATE,
    2 count (1) Record_count
    3. FOR "RATOR_CDR." "" BILLING_RECORD_KPN_ESP ".
    "4 where CHARGE_DATE > 20 January 2013."
    Group of 5 by trunc (CHARGE_DATE)
    6 order by trunc (CHARGE_DATE)
    5 m

    CHARGE_DATE RECORD_COUNT
    ------------------ ------------
    192610 20 January 13-> > more records here
    JANUARY 21, 13 463067
    JANUARY 22, 13 520041
    23 JANUARY 13 451212
    JANUARY 24, 13 463273
    JANUARY 25, 13 403276
    JANUARY 26, 13 112077
    27 JANUARY 13 10478
    28 JANUARY 13 39158

    Thank you!

    Because in the second example you also select rows that have a nonzero component.

    The first example selects only rows that are 00:00:00

    (by the way, you should ask questions like this in the forum SQL)

  • Best film for the reversals of model format?

    I am re - work my portfolio site and looking for a better way to make my 3D Max models rotations. I am looking at two options, but both have their advantages and disadvantages:

    QUICKTIME:

    It's the way I'm currently doing reversals of model, using Quicktime:

    http://www.mickposch.com/high_poly/high_poly_vdad.htm


    The good thing about QT is that the anims are looping - you can press the play button and the model keeps running until you stop it. There is also a very good interactivity - you can view the model from different angles rubbing them. So, what's the problem? If you zoom your browser to blow up the image (using Ctrl + Plus), all on the page scales except the film - which leaves an ugly white space around it. I know not how to change the code so that the film evolves upwards with the page, but it's horrible - pixelated than jpg and other elements of the page files.

    JW PLAYER:


    The other option I'm considering for the turnaround is the JW Player. I already use it in another section of my site for clips of animation:

    http://www.mickposch.com/animation/animation_sof.htm

    JW works very well for these clips - they scale well when you zoom upward into the browser, and you also have the option to go full screen. But if I use this method for the reversals of model, there are a few problems: there is no way to make them in a loop, the interaction when you rub is not as smooth as it is with QT, and they always start with the arrow "Play" is huge covering part of the image. The colors also slightly shifted their correct values. This are very big problems in the section of movie clip, but would be a problem for the reversals of model.

    So, any ideas on a better way to make the turnovers? I even wouldn't mind sticking with Quicktime, if I could find a way to eliminate that ugly white space (or make the same color as the background).

    Another alternative is SketchFab: http://sketchfab.com/

    Or: http://verold.com/

    I would avoid QT as the plague today for the web: Quicktime is not installed on a large number of machines.

    Or if not something like this: https://rotaryview.com/

  • ESXi is unable to install 'his place on the disk for the dump data' no ideas?

    It is an older server.

    Data sheet:

    GOING Linux 2200 series

    Intel P3 700 MHz x 2

    768 MB OF RAM

    9.1 GB SCSI x 3 (configured in RAID 5 now)

    I have attached a picture of the error message that is received and typed most of the message below.

    NOT_IMPLEMENTED /build/mts/release/bora-123629/bora/vmkernel/sched/sched.c:5075

    Frame 0x1402ce0 ip = 0x62b084 cr2 = cr3 = 0 x 0 = ox3000 cr4 = 0 x 20

    are is 0xffffffff ds is 0xffffffff fs = 0xffffffff gs = 0xffffffff

    EAX = 0xffffffff = 0xffffffff = 0xffffffff edx ecx ebx = 0xffffffff

    = 0x1402e3c = 0xffffffff edi esi EBP = 0xffffffff err =-1 eflags = 0xffffffff

    * 0:0 / & lt; NULL & gt;  1:0 / & lt; NULL & gt;

    0x1402e3c: battery: 0x830c3f, 0x1402e58, 0x1402e78

    VMK availability: 0:00:00:00.026 TSC: 222483259709

    No space on disk for the dump data

    Waiting for debugger... (World 0)

    Debugger is listening on the serial port...

    Press ESC to enter the local debugger

    This could be a simple problem or not, I'm not sure. I spent several hours already trying to reconfigure the readers to try to get the installation to recognize.

    Any help is greatly appreciated.

    I agree with Matt, the material can be simply too old-

    If you find this or any other answer useful please consider awarding points marking the answer correct or useful

  • Recommended value for the BAM data expiration time

    Hello

    Can someone tell me what is the recommended value for the BAM data expiration time?

    Enterprise Server default is 24 hours, but I would like to be able to raise the average runtime instance after several months. Is it reasonable to the value of the time-out value a high value? Or it will have an impact on the performance of BPM/BAM?

    Thanks in advance.

    Best regards
    CA

    Normally, we keep the BAM data expiration time at halfway with 24 to 72 hours. For historical reports that you are looking for the Data Mart / Data Warehouse DB are more logical. This database stores the data forever and takes pictures at longer intervals, normally 24 hours. These data are not in time real normally then because a capture instant is only taken once per day but will give you historical reports that you are looking for. The data from this database structure is almost identical to the BAM DB.

Maybe you are looking for

  • Turn off every macOS as public beta Sierra updates

    How can I disable macOS 10.12.1 Public Beta 1 update notice?  I currently installed (and running) MacOS Sierra "free version". The APP Store software update wants to update my Public Beta 1.  I am not now under 'Public Beta' and I don't want to conti

  • Equium P200-1ED - Question on the possible 2nd HD and RAM

    Hello I've got the Equium P200-1ED and in the manual (page with diagrams showing the characteristics of the laptop), it mentions a second hard drive.I know my P200 does not have a second mounted drive so does that say space to eventually mount a seco

  • Missing DVD CDrom drive

    A few days earlier, the CD-ROM drive (a combo SD-R2212) suddenly disappeared. Apparently not a hardware problem, since it recognizes a bootable CD. The Explorer shows just the same drive in the Device Manager. No individual error or warning message a

  • MacBook Pro gets constantly spinning reel after downloading El Capitan. Any help is appreciated.

    General purpose is simply slow. Even typing this message is a pain because of the intermittent freezing. No idea how to solve this problem? Here are my stats from EtreCheck: EtreCheck version: 2.6.6 (226) Report generated on 09/12/15 13:30 Duration 3

  • Computer doesn't recognize not update Service Pack 1

    Original title: you read these questions? the responses I've read so far say NO The question I ask has been requested several times, but the responses I've seen do not address the issue, just to give instructions on how to install SP1, but not how to