using a drop-down list to power a listview

I try to get a drop-down list selection (newOption) to fuel a sql query to get more information in a listview. The drop down menu works ok, but the list is empty. My dosent sql query recognize newOption and therefore does not feed listview.

Please could you help me with the query syntax. Thank you.

My code is below.  If I replace '+' "' + newOption +" ' with a sql table entry, IE 'the cradle', then the listview works very well.

import bb.cascades 1.2
import bb.data 1.0
import com.apiary.data 1.0

{Page}
ID: infoPage

{Of container
{Label
text: "Info Page".
verticalAlignment: VerticalAlignment.Center
horizontalAlignment: P
}

{Drop-down list
ID: dropdown
}

{To ListView
ID: apiaryList
dataModel: dataModel

listItemComponents:]
{ListItemComponent}
type: 'point '.
{StandardListItem}
ID: apiaryItem

Title: ListItemData.apiary_name
Description: ListItemData.apiary_location
status: ListItemData.apiary_id
}
} / / end of ListItemComponent
]

onTriggered: {}

}
}
attachedObjects:]

{GroupDataModel}
ID: dataModel2
},
{ComponentDefinition}
ID: optionFactory
Option {}
}
},
DataSource {}
ID: dataSource2
Source: "sql/hood_apiary.db.

query: "SELECT * FROM Apiary ORDER BY apiary_name".

onDataLoaded: {}
dataModel2.insertList (data);

Now, this is going to populate the drop-down list while reiterating each
the query data and adding one by one to the drop-down list
using the optionFactory component to dynamically add definition
New Options for the drop-down list
for (var i = 0; i)< data.length;="">
{
Create new Option
var newOption = optionFactory.createObject)

Set the text of the Option categoryfield (title of the drop-down list)
newOption.text = data .apiary_name [i]
Console.log ("newoption.text =" + newOption.text);

Add the Option in the drop-down list
DropDown.Add (newOption);
}
}
},

{GroupDataModel}
ID: dataModel
},
DataSource {}
ID: dataSource
Source: "sql/hood_apiary.db.

string newOption property
query: "SELECT * FROM Apiary, hive where apiaries.» [apiary_name] = ' "+ newOption +" ' AND Apiary. [apiary_id] = hive. [apiary_id] AND the hive. [apiary_id] is not null ORDER BY hive_id DESC'
onDataLoaded: {}
dataModel.insertList (data);
}
}
]

onCreationCompleted: {}
When the display of the list has been created, load the data into the listview
and the drop-down list.
dataSource.load ();
dataSource2.load ();
}
}

}

Hello Simon

Thank you very much for your help, you have solved a problem I had for centuries.

{Drop-down list
ID: apiarydropdown
Title: 'select the Apiary.
onSelectedIndexChanged: {}
var dropvalue = apiarydropdown.at ("apiarydropdown.selectedIndex") .text;
Console.log ("dropvalue has been changed to" + dropvalue);
Console.log ("selectedIndex was changed to" + selectedIndex);
dataSource.query = "SELECT * FROM Apiary, hive where apiaries.» [apiary_name] = ' "+ dropvalue +" ' AND Apiary. [apiary_id] = hive. [apiary_id] AND the hive. [apiary_id] is not null ORDER BY hive_id DESC'
dataModel.clear () / / clears all previous listview view
dataSource.load () / / load listview
}
}

Tags: BlackBerry Developers

Similar Questions

  • How can I use two drop-down lists for a time value?

    I want to enter the length of time someone did something in hours and minutes using two drop-down lists, then enter it as a time value only (├a) in Mysql.

    I used the dropdown database lists and a few different variations of what follows without success (seconds is a hidden field with a value of "00"):

    GetSQLValueString (strftime ("% H: % i: %s", strtotime ($_POST ["sleeptimemin"].))) " «. $_POST ['sleeptimehr']. » «. (_POST ["seconds"])) $, 'date').

    This comes back to 00:00:16, regardless of what is selected in the drop-down list.

    Any help would be appreciated.

    MySQL stores time in human-understandable format, using the 24-hour clock.

    GetSQLValueString($_POST['sleeptimehr'] . ':' . $_POST['sleeptimemin'] . ':00', "date"),
    
  • JavaScript to set radio button choices using the drop-down list box value.

    I use Adobe Acrobat Pro DC version 2015.016.20039 on a MacBook Pro OS X El Capitan version 10.11.6.

    I have a set of named CitBox radio box choices. I'm defining what choice is selected from out of a drop-down list named AppCitizenship box.  Both of them have six choices with values of 1, 2, etc. (I thought having the same values would make easier the translation from one to the other). Thanks in advance.

    If you used the same values, then it is pretty easy. Just use this code as the validation script custom field drop-down list:

    this.getField("CitBox").value = event.value;

  • Acrobat Pro XI - import Pdf when you use the drop-down list

    Hello Adobe community,

    WARNING: Newbie here

    I am trying to import an existing pdf, after that the user has selected an item in the drop-down list. For example; I have a form with a menu drop-down and three points on the list (caustic diesel, heavy and hydrocarbons). Each item in the list has its own PDF which must to be imported into the document if selected. Once the user has selected in the list, I need to import a pdf file into the existing document. I did some basic research, but can find no chance.

    Any tips or tutorials that I can search will be appreciated.

    Thank you

    Again, it is delicate. You can show/hide entire pages to convert them into models and by changing the value of their hidden property, but this only works in Acrobat. In Reader, you will need to convert the model pages, hide them and then use a script to spawn them when you want to show them and then delete them when you want to hide once more. Possible, but not easy to implement.

  • Attendance problem when you use a drop-down list

    I'm trying to show/hide a table when a choice is made in a menu drop-down. It does not work until I did the same thing twice, then I get the expected result. The script is changing and I have used it before with success, although it generally uses a check box. Y at - it an easy solution if everything goes well for this problem? Code below:

    If

    (this.rawValue == 2)

    {

    Form1. Page1.OrderSection.OrderItems.blower.presence

    = 'visible ';

    }

    on the other

    {

    Form1. Page1.OrderSection.OrderItems.blower.presence

    = 'hidden ';

    }

    Thank you

    Drop-down lists work slightly differently than expected. the Change the rawValue event contains selected text previously.  That's why it works the second time.  The current selection is contained in: xfa.event.newText

  • Using the drop-down list cascading... is it possible...

    The list of parent choice consists of several values, call them A B C D E and F.

    I want only the list of choice subject to have values for the parent of E and F. I don't see a way to set the parent of A & D without value for the related selection list. Am I missing it? It would be nice to have the choice of child list is valid when the element E or F is selected.

    Any thoughts?

    You must set a value such as 'No value' will be used for the values of A - D in the drop-down list for the list of subordinate choice parent.

  • Using dynamic drop-down list

    I've seen countless videos and read a lot of posts on how to create drop down menus, but the script I write still does not work. I am trying to create something pretty basic. I have two drop-down menus on two different pages. The value of the drop-down list on the first page will decide what appears on the drop-down list on the other page. I specified values of element for both lists. Any help would be greatly appreciated. Thanks in advance. So far, the code I created is as follows:

    switch (this.rawValue) { }

    case "1" :

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem ("primary insured
    "or staff 24/7");

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
    ("70%-working torque");

    breaking ;

    case "2" :

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem ("primary insured or personal 24/7");

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
    ("70%-working torque");

    breaking ;

    case "3" :

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
    ("Unoccupied 3-6 month/year");

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
    ("Unoccupied more than 6 month/year");

    breaking ;

    case "4" :

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
    ("Unoccupied 3-6 month/year");

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
    ("Unoccupied more than 6 month/year");

    breaking ;

    case "5" :

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
    ("Unoccupied 3-6 month/year");

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
    ("Unoccupied more than 6 month/year");

    breaking ;

    case "6"

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
    ("Unoccupied 3-6 month/year");

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
    ("Unoccupied more than 6 month/year");

    breaking ;

    case "7"

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
    ("Unoccupied 3-6 month/year");

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
    ("Unoccupied more than 6 month/year");

    breaking ;

    by default:

    OccupancyDropDown.addItem ("Please choose
    "" "Occupation");

    breaking ;

    }

    Hi, in your code need you 2 things...-> «:»

    case "6": <>

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
    ("Unoccupied 3-6 month/year");

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
    ("Unoccupied more than 6 month/year");

    break;

    case "7": <>

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
    ("Unoccupied 3-6 month/year");

    ShortList.WaterFireBurglary.WaterDamageOccupancy.addItem
    ("Unoccupied more than 6 month/year");

    break;

  • How to use the drop-down list box to fill in a text box

    I'm a beginner when it comes to Java Script.  I have seen a lot of different discussions, look at a lot of articles "helping" Acrobat 9 and Java Script, but only to be left confused and dazed.  I hope someone can tell me how to write a script that fills a text box that sits on my form with the value of exports of the selection in the combo box...

    Thank you

    If you want that the read-only text box, simply set with the following custom calculate script:

    Set this field to the value of the drop-down list box

    Event.Value = getField("combo1").value;

    but replace "combo1' with the actual name of the combo box field.

    If you want something else, post again with more information.

  • Using a drop-down list to make a subform becomes visible/invisible

    I'm trying to do something simple... I can't work. I have a menu named 'property' (which is part, BECAUSE the BORROWER HAVE a PROPERTY INTEREST IN ANY OTHER GOOD? and I have choices 'Y' and 'n'.) When the user selects 'Y' I want the subform (which is currently invisible) named "sometimesHidden" to appear. Then, if the user selects "N" after that they have already selected 'Y' I want it to disappear. It's a Virgin with no O/N by default, just empty form. It turns out to be just... There is no need to pass anything... just appear and disappear.

    Capture.JPG

    I tried to run on the 'Output' in JavaScript for menu drop-down mode. I tried to use other examples and nothing. Any help?

    Thank you!

    I got it to work by changing the save options from a static to a dynamic PDF PDF. I'm not a coder very decent, just, I went in the designer of the Action and created a show and hide Action on this article and it has worked very well. If I left it as a static PDF code show/hide and the Action never worked. Once I saved it as a PDF dynamic, it worked very well.

  • Unable to resize using the drop-down list of image Photoshop 2015 CC

    I recently had to rebuild my system (yesterday) include motherboard and computer.

    That's why I need to download and reinstall Photoshop 2015 CC. It lies the new "PC name" resumed. I turned off the old system.

    Problem.

    When I try to resize any photo using the height or width of the Image - the Image size-, I'm unable to change the values.

    Any ideas.

    Chomp

    Opens the dialog box resize the Image and you can target these areas?  Have you tried resetting your Photoshop tools?

  • Don't want to use a drop-down list field

    I use a text box I want only user can enter into an 'a' or a 'd', how do I make this happen?

    Thank you

    Add the following function to a JavaScript script at the level of the document and call it from event hits the field:

    function AorD_ks() {
    
        // Get everything that's entered in the field
        var val = AFMergeChange(event);
    
        // Allow a blank field
        if (!val) return;
    
        // Reject everything other than a or d, or A or D
        event.rc = AFExactMatch(/^(a|d)$/i, val);
    }
    

    Remove the i in the regular expression if you don't allow uppercase.

    He didn't really need is that it's what you want, but to show a good generalist.

  • Submit a form by using a drop-down list

    Hi I'm doing a fall to downgrade active so that when you make a selection, it supports the form rather than havingto use a "submit" button

    Any ideas Geoff Cheers

    Dreamweaver-> Insert-> form

    Dreamweaver-> Insert-> Menu of rerouting

    From the window menu jump let Insert go button after menu disabled

  • States of the changes by using the drop-down list box

    I have created a form with payment options in Adobe Flex. There will be 2 options of payment, cash and credit card. When a user selects an option it must fill in a few details. I created different States for the option of credit and card, which will appear as and when the option is selected. I'm not able to get the change to the State when an option is selected. Please help me in this regard.

    Try this:

    public function paymentState (): void
    {
    If (payment.selectedItem.label == 'Cash') {}
    currentState = "CashState";
    }
    Else if (payment.selectedItem.label == 'Credit Card') {}
    currentState = "CreditState";
    }
    Else if (payment.selectedItem.label == "Chèque") {}
    currentState = "ChequeState";
    }
    }

  • Using Wizard of the Action to change the font in the drop-down list box

    Acrobat Pro DC on a MAC under OS X 10.11.6

    I have a form that is mainly created in Indesign (it works for us - I know that others prefer to locate forms purely in Acrobat).

    I have a script I can run through the wizard of the Action (run a javascript script) to change the font in all fields in text form. But being a novice script that I can not understand how to create a similar script that will change the font used by drop-down list boxes (created in Indesign). Is it possible by a script?

    I know I can do it manually through the properties, but if someone can give me a pointer to find a way to do it with a script that would be amazing!

    Thank you

    The script can be changed to:

    for (var i = 0; i)< numfields;="" i++)="">

    var f = getField (getNthFieldName (i));

    If (f.type = 'text' | f.type = "combobox") {}

    f.textFont = "Arial";

    f.textSize = "10";

    }

    }

    But now I have to ask, what are your reasons to use Arial instead of Helvetica?

  • Using a choice of multiple words in a drop-down list field to launch a java script

    I'm a complete newbie to manuscript of java and relatively new to your building in Acrobat.

    I use a drop-down list field to fill in automatically other fields based on my 1st drop-down list selection.

    The 1st field drop-down allows me to select a variety of suppliers.  Once I have selected the vendor, he auto-remplit the coordinates for this provider.

    I've plagiarized the writing of scripts from this link: https://acrobatusers.com/tutorials/change_another_field.  I even changed my domain names for the moment.  I'll change my return form field names and the script to match once I got it working like I want.

    If I use only one name in my drop down list provider (1 field), the script works perfectly and auto-remplit contact as expected information.  However, many of my suppliers are two words or more... and I need those names in print, so I can't do just a contraction of a Word.  Here is the script I use:

    Here is an example of a supplier of single word name that works as expected:
    Put all vorkriegsbevölkerung data in a single data structure
    var DeptData = {ADLEMI: {contact: "P.O. BOX 2371",}}
    E-mail: "DOWNEY, CA 90242."
    {{deptnum: "PHONE: (562) 923-0333 FAX: (562) 923-8111 '}};
    function SetFieldValues (cDeptName)
    {
    this.getField("DeptContact").value = DeptData [cDeptName] .contact.
    this.getField("DeptEmail").value = DeptData [cDeptName] .email;
    this.getField("DeptNumber").value = DeptData [cDeptName] .deptnum;
    }

    Unique provider name, I used in the example above is "ADLEMI."  If I add 'BEST' to ADLEMI (see below), I get a syntax error.  I really need to be able to use several words in my list drop-down provider to trigger auto-fill.

    Put all vorkriegsbevölkerung data in a single data structure

    var DeptData = {ADLEMI BEST: {contact: "P.O. BOX 2371",}}

    E-mail: "DOWNEY, CA 90242."

    {{deptnum: "PHONE: (562) 923-0333 FAX: (562) 923-8111 '}};

    function SetFieldValues (cDeptName)

    {

    this.getField("DeptContact").value = DeptData [cDeptName] .contact.

    this.getField("DeptEmail").value = DeptData [cDeptName] .email;

    this.getField("DeptNumber").value = DeptData [cDeptName] .deptnum;

    }

    The only difference is that I added a space and the word 'BEST' after ADLEMI.  Is there a way to get around this.  I need to have several words in my drop-down list, or at least the full name of the vendor indicating in the field when I print it.

    Thank you

    Place quotation marks around the name of the element.

    Monday, April 13, 2015, at 17:29, bpwhistler, [email protected]>

Maybe you are looking for