If argument with a tiny indexOf problem

These values get through the argument:
may
may/jun
and get separated
This does not:
may/jun/jul
What am I doing wrong here?
function Blomstring(ar){
var newAr = [];
var newData = [];
var findEl = false;
var el = "";
for(var i=0; i<ar.length; i++){
findEl = false;
el = ar[i]['Blomstring'];
if(el == '' || el.indexOf('/')!=-1){
          continue;
          for(var j=0; j<newAr.length; j++){
                    if(newAr[j]==el){
                    findEl = true;
if(findEl==false){
newAr.push(el);

To make it short:
I have list1 that is populated with plant names.
Then I have list2 which is connected to the function shown above, that will filter plants that that bloom in specific months.
My large xml file has however plants that bloom not only in may, but may/jun, may/jun/jul etc.
The if argument in the code shown above makes may/june, show up correctly as both may and jun in filter list2, and it filters list1 correctly. But may/jun/jul, or jul, or jul/aug doesn't show in the filter list2
The problem arises when i have 2  "/" like in jun/jul/aug
if(el == '' || el.indexOf('/')!=-1){
          continue;
Here is the full function:
function Blomstring(ar){
var newAr = [];
var newData = [];
var findEl = false;
var el = "";
for(var i=0; i<ar.length; i++){
findEl = false;
el = ar[i]['Blomstring'];
if(el == '' || el.indexOf('/')!=-1){
          continue;
          for(var j=0; j<newAr.length; j++){
                    if(newAr[j]==el){
                    findEl = true;
if(findEl==false){
newAr.push(el);
newAr.sort();
          for(var k=0; k<newAr.length; k++){
          newData.push({'label':newAr[k]});
list2.dataProvider = new DataProvider(newData);
Blomstring(a);
list2.addEventListener(Event.CHANGE, change4);
function change4(event:Event):void {
searchInput.text = "";
filterBlomstring(list2.selectedItem.label,a);
//Deselects the other filter lists
list3.selectedIndex = -1;
list4.selectedIndex = -1;
function filterBlomstring(filter,ar){
var newData = [];
var newAr = [];
var el = "";
var findEl = false;
          for(var j=0; j<ar.length; j++){
                    el = ar[j]['Blomstring'];
                    if(el.indexOf(filter) != -1){
                              newAr.push(ar[j]['Botanisk_navn']+'\n'+"-" + ar[j]['Norsk_navn']);
newAr.sort();
          for(var k=0; k<newAr.length; k++){
          newData.push({'label':newAr[k]});
//listAr is what is being populated in "list"
listAr = newAr;
list.dataProvider = new DataProvider(newData);
firstRow();

Similar Messages

  • Help with add file name problem with Photoshop CS4

    Frustrating problem: Help with add file name problem with Photoshop CS4. What happens is this. When I am in PS CS4 or CS3 and run the following script it runs fine. When I am in Bridge and go to tools/photoshop/batch and run the same script it runs until it wants interaction with preference.rulerunits. How do I get it to quit doing this so I can run in batch mode? Any help is appreciated. HLower
    Script follows:
    // this script is another variation of the script addTimeStamp.js that is installed with PS7
    //Check if a document is open
    if ( documents.length > 0 )
    var originalRulerUnits = preferences.rulerUnits;
    preferences.rulerUnits = Units.INCHES;
    try
    var docRef = activeDocument;
    // Create a text layer at the front
    var myLayerRef = docRef.artLayers.add();
    myLayerRef.kind = LayerKind.TEXT;
    myLayerRef.name = "Filename";
    var myTextRef = myLayerRef.textItem;
    //Set your parameters below this line
    //If you wish to show the file extension, change the n to y in the line below, if not use n.
    var ShowExtension = "n";
    // Insert any text to appear before the filename, such as your name and copyright info between the quotes.
    //If you do not want extra text, delete between the quotes (but leave the quotes in).
    var TextBefore = "Lower© ";
    // Insert any text to appear after the filename between the quotes.
    //If you do not want extra text, delete between the quotes (but leave the quotes in).
    var TextAfter = " ";
    // Set font size in Points
    myTextRef.size = 10;
    //Set font - use GetFontName.jsx to get exact name
    myTextRef.font = "Arial";
    //Set text colour in RGB values
    var newColor = new SolidColor();
    newColor.rgb.red = 0;
    newColor.rgb.green = 0;
    newColor.rgb.blue = 0;
    myTextRef.color = newColor;
    // Set the position of the text - percentages from left first, then from top.
    myTextRef.position = new Array( 10, 99);
    // Set the Blend Mode of the Text Layer. The name must be in CAPITALS - ie change NORMAL to DIFFERENCE.
    myLayerRef.blendMode = BlendMode.NORMAL;
    // select opacity in percentage
    myLayerRef.opacity = 100;
    // The following code strips the extension and writes tha text layer. fname = file name only
    di=(docRef.name).indexOf(".");
    fname = (docRef.name).substr(0, di);
    //use extension if set
    if ( ShowExtension == "y" )
    fname = docRef.name
    myTextRef.contents = TextBefore + " " + fname + " " + TextAfter;
    catch( e )
    // An error occurred. Restore ruler units, then propagate the error back
    // to the user
    preferences.rulerUnits = originalRulerUnits;
    throw e;
    // Everything went Ok. Restore ruler units
    preferences.rulerUnits = originalRulerUnits;
    else
    alert( "You must have a document open to add the filename!" );

    you might want to try the scripting forum howard:
    http://www.adobeforums.com/webx?13@@.ef7f2cb

  • Under Windows 7, 64-bit, Firefox intermittently will not open a new window - all I get is a grey screen, with a tiny part of my homepage displayed in the top left corner of the screen.

    The problem began after a recent Firefox update. Occasionally, when I try to open a new Firefox window, all I get is a grey screen with a tiny section of my homepage visible in the top left corner of the screen. NOTE: Firefox stores all of these aborted attempts, as, whenever I close it and then re-open it, the first time I open a new window it automatically opens all of the windows that had originally failed to open.
    == This happened ==
    Every time Firefox opened
    == on or about June 26, 2010

    Got the exact same problem aswell, finally fed up with it now as i just started up firefox and 14 new windows opened because of this bug, luckily my computer can handle them but someone with a slower processor it would have been a nightmare, needs fixing ASAP.
    Reverting back to 3.6.3 until this issue is solved. (link for anyone wanting to do the same below)
    http://www.filehippo.com/download_firefox/7345/

  • The key could not be obtained. You may need to use the -keystore argument with the specified keystor

    I am getting this error: "The key could not be obtained. You may need to use the -keystore argument with the specified keystore type." when trying to create an apk file using adt. I am following the steps mentioned here: http://blogs.adobe.com/ria/2010/10/28/creating-an-apk-file-using-flashbuilder-4-0/

    Could a self save from premiere cause the problem? By this i don't mean the autosave.
    Autosave is the only kind of 'self save', and is not likely to 'cause' project corruption.
    thnx for your reply. My first question came from a remark of Gakhue:
    "I'm using CS6 and I got that warning, I copied my project file on usb stick and re-opened in a different computer using CS5, it then gave me a few warnings about changing the name and saving it to auto save fault, I clicked away and said yes to each one"
    So i wondered how he did it
    The second question came from the fact that my last save was from 17 minutes after i left my studio. And i am not talking about an autosave. It was the main save of the corrupted videofile. And since i did not do it myself, the only option left is that Premiere did it? Or that premiere does not use the internal Mac clock and is on a different time. Which is not the case (just tested).

  • Sir i am using datasocket read ,i am communicating with java but my problem is that bcz im using while loop to see if value has changed my labview consumes all the processors time ,sir i want a event like thing so that while loop is not in continuous loop

    sir i have given lot of effort but i am not able to solve my problem either with notifiers or with occurence fn,probably i do not know how to use these synchronisation tools.

    sir i am using datasocket read ,i am communicating with java but my problem is that bcz im using while loop to see if value has changed my labview consumes all the processors time ,sir i want a event like thing so that while loop is not in continuous loopHi Sam,
    I want to pass along a couple of tips that will get you more and better response on this list.
    1) There is an un-written rule that says more "stars" is better than just one star. Giving a one star rating will probably eliminate that responder from individuals that are willing to anser your question.
    2) If someone gives you an answer that meets your needs, reply to that answer and say that it worked.
    3) If someone suggests that you look at an example, DO IT! LV comes with a wonderful set of examples that demonstate almost all of the core functionality of LV. Familiarity with all of the LV examples will get you through about 80% of the Certified LabVIEW Developer exam.
    4) If you have a question first search the examples for something tha
    t may help you. If you can not find an example that is exactly what you want, find one that is close and post a question along the lines of "I want to do something similar to example X, how can I modify it to do Y".
    5) Some of the greatest LabVIEW minds offer there services and advice for free on this exchange. If you treat them good, they can get you through almost every challenge that can be encountered in LV.
    6) If English is not your native language, post your question in the language you favor. There is probably someone around that can help. "We're big, we're bad, we're international!"
    Trying to help,
    Welcome to the forum!
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Mid 2011 mbp i7 with a SSD has problems, including grey screen/blue screen/beeping/freezing when I stream live video (i.e. watch espn or time warner cable) Help? Ideas?

    Recently my Macbook Pro (June 2011, i7, 8gb RAM, 512gb SSD, AMD Radeon 6750, Mountain Lion - since July - currently 10.8.2) has been presenting me with an array of problems, usually initiated when I am streaming live video. I was streaming Time Warner Cable on 12/9 and it gave me what looked like the blue screen of death.  It started up after about five attempts that time. The other day, after about a week of not using the computer, it wouldn't boot past the grey screen. I (option) started it and it gave me two boot choices, the regular HD and a "10.8 restore" option.  The HD gave me the grey screen and the restore option gave me the dark blue screen. I reset PRAM and that didn't work.  After a force (x) start it worked.  Today, I was using "Watch ESPN" and the screen froze and the computer did some kind of repeating RAM beep or something.  I rebooted and it started up fine.  I'm not watching any videos anymore, but this is a problem since the primary purpose for my mbp is video editing. I'm still under AppleCare but I find more solid answers in the forums or at least better questions for the AppleCare people.
    Anybody have similar experiences, or a solid idea of what the heck has happened to my machine?

    I'm not really sure what method that person was talking about. I just read he had a successful install so I posted it.
    But I'll hazard a guess
    1. copy your entire drive to a backup drive
    2. boot into that drive and test it out - make sure its a flawless backup, it works, and the hard drive has no problems
    3. eject that drive, disconnect it and reboot into the leopard install dvd
    4. erase your main hard drive using disc utilities on the leopard install dvd -- you've made a backup, made sure that backup was good, and disconnected it so it's currently safely disconnected from the leopard install you're about to do. Also, on the hard drive you're erasing and installing leopard on to, many people recommend "Zeroing" it as well as erasing it. That option is part of the erase function in disc utilities on the leopard install disc.
    5. do a clean install of leopard
    6. follow step 4 from that original post exactly as that person described to do.
    7. read the rest of what they said
    That's pretty much it. With the backup/erase/clean install/import/ you pretty much get everything you need exactly the way you want it with very few things missing -- and you've done this over a clean install. Plus that poster did mention that you can select what you want to import from your backup hard drive.
    It sounds like its a "clean install" method that gives you control via "import from machine" option in the installer. Control over what parts of your "old mac" you want to import into your "new leopard mac".
    Hopefully that helps. It sounds more involved, but its actually pretty quick and provides you with a perfectly save backup in case anything goes wrong with the leopard install.

  • I install LION on my mac pro 2008 and it's alway's pop with " there was a problem connecting to the server " Time Capsule" .How can i remove this popup. My Time machine is working fine and also rename it. But the popup keeps on coming with the old name.

    I installed LION on my mac pro 2008 and it's alway's pop with " there was a problem connecting to the server " Time Capsule" .How can i remove this popup. My Time machine is working fine and also rename it with less than 7 karakters. But the popup keeps on coming with the old name.

    I have a BT Infinity router plugged into the Time Capsule, not sure where the radio settings are?
    They are able to use the network settings of the TC i.e. they can connect to the internet via the wifi through the TC but when they try and connect to the AirPort Disk this is where it is not allowing a connection.
    I don;t have the drive shared out at all at the moment, is this necessary?  How do I do this if so?
    I have attached the screen shots of all the settings.
    Thanks again for your help.

  • 9 month old Zen Micro with the headphone jack problem

    So, I've been putting up with the headphone jack problem for a few months now, and i've finally decided to get it repaired or fixed. I emailed Creative a few months back and they told me to send it in. My question is, since I am out of warranty, will they repair the unit or send me a whole new one all together?
    thanks,
    mike

    Actually, I just sent in my 7-month old Micro in b/c of the headphone jack problem and they sent me a brand new shrink-wrapped one. They <EM>didn't </EM>charge me for anything. All I had to do was wait 2 weeks for them to send it back to me (grueling but doable) and pay about 2.44 for shipping the micro to them. So now I'd have three batteries if it weren't for the fact that one of them swelled up; I have NO IDEA how that happened. So yeah I guess the point of the post is that you don't get charged anything even if you're out of the 90-day labor warranty.

  • I have iphone 4s with iO6. My problem is I can no longer update my apps since "cannot connect to itunes" always shows on my screen when i try to. Tried fixing by changing the dates, turning off location as suggested in some forums but both didn't work!

    I have iphone 4s with iO6. My problem is I can no longer update my apps since "cannot connect to itunes store" always shows on my screen when i try to. Tried fixing by changing the dates, turning off location as suggested in some forums but both didn't work!  Please help!! Thanks.

    You can not merge accounts.
    Apps are tied to the Apple ID used to download them, you can not transfer them.

  • My IPOD Classic Video 5. Gen. showed videos, but now it does no longer show them, instead i see a black picture on my IPOD and it doesn`t work. I have to restart it every time, i try it. i restore the software with itunes, but the problem still exists.

    My IPOD Classic Video 5. Gen. showed videos, but now it does no longer show them, instead i see a black picture on my IPOD and it doesn`t work. I have to restart it every time, i try it. i restore the software with itunes, but the problem still exists.
    The Videos are showed up front 4 months, but now they are no longer to be seen. When you star a video first the hard drive starts, but then it stops and hangs up. I have to restart it, starting with the apple logo....

    Here is what worked for me:
      My usb hub, being usb2, was too fast. I moved the wire to a usb port directory on my pc. That is a usb1 port which is slow enough to run your snyc.

  • TS3276 Hey. I have problems to send e-mail with Mail. The problems is I need to un active ssl ,... but when I do this,... automatically,. its active again????. Whta can i do

    Hey. I have problems to send e-mail with Mail. The problems is I need to un active ssl ,... but when I do this,... automatically,. its active again????. Whta can i do

    Try posting this in the 10.7 Mail forum. You'll get more help there.
    DALE

  • I have recently reinstalled my mac air with the tiny usb device provided and some of the software/apps which came with the mac is now gone! how do i get it back. thanks.

    i have recently reinstalled my mac air with the tiny usb device provided and some of the software/apps which came with the mac is now gone! how do i get it back. thanks.

    thank you so much ill give it a shot

  • My Mac mini with my samsung screen, Problem is it not windscreen ?

    My Mac mini with my samsung screen, Problem is it not windscreen ? Help me

    How is it being connected?
    What is resolution of display?
    What OSX version?
    Have you tried different resolution settings in System Preferences>Displays>Scaled

  • HT1752 I am working on a chart in paged with 7 columns. Problem has occurred with amount of row. I have completed 999 rows and it won't allow me to continue. As I need to do approx 3000+ rows, can anyone explain to me how to add extra rows. Thanks Jane

    I am working on a chart in pages with 7 columns.
    Problem has occurred with amount of rows. I have completed 999 rows and it won't allow me to continue. As I need to do approx 3000+ rows, can anyone explain to me how to add extra rows. Thanks Jane

    Try posting in the Pages forum
    https://discussions.apple.com/community/iwork/pages

  • Please Help Me With My Yahoo App Problem

    Please Help Me With My Yahoo App Problem, Everytime I Want To Log In To Yahoo With Yahoo Application This Messege Appears, Please Help Me With this

    Do you have a blackberry data plan as opposed to a standard carrier data plan? 

Maybe you are looking for

  • Scalability of Business Catalyst for non public domain use.

    I have a client looking for a CMS setup that would be more like an intranet than a website, but it seems that all levels of subscription for BC have no more than 10 users as a limit. Is there a version that would allow significantly more? The traffic

  • Porting Flex 2 apps to Flex 3 (SDK)

    Is there a list somewhere of the specific changes made in Flex 3? http://blogs.adobe.com/flexdoc/2008/02/migrating_from_flex_2_to_flex.html Ok, this helps, but looking here, it mentions style property changes.  Trying SDK 3 real quick on an SDK 2 app

  • Safari Automatically Opens after Starting or Restarting???

    Every time I start up or restart my iMac, Safari automatically opens.  It and no other apps were open when I restarted or shut down.  Why would this be happening and how do I stop it? I looked under System Preferences - Users - Login Items and Safari

  • Regex matches function

    Hi I am trying to come up with a regex that I can use with the matches function to validate the user id I accept. The user id can contain alphabets, numbers and 3 special chars ".","-" and "#". The regex I came up with was: user_id.matches("[a-zA-Z\\

  • What is it going to cost to replace LCD on a iMac 27"

    What is it going to cost to replace LCD on a iMac 27" Need to replace mine, since it has a tear (best word I could think of), it's not a issue to the point that the iMac works fine, it's just annoying to work on any thing with the mark on the screen.