Facility Control

 View Only
  • 1.  Dropdown Issue

    Posted 06-06-2017 12:26

    Hi Guys

    I have added a dropdown and a load button reading from an XML

    It was all working perfectly, it still loads the data but when I click on a team name, the dropdown says "Nothing" I have added a picture.

    Any help would be great 



  • 2.  RE: Dropdown Issue

    Posted 06-06-2017 20:15
    It looks like the IDs might not be getting created properly... can your script (the final version you used) and a snippet from your XML?
    #DashBoard


  • 3.  RE: Dropdown Issue

    Posted 06-07-2017 10:05

    Hi James

    Iv attached some images. Iv attached an image of the dropdown parameter values. I have also attached the panel code and my XML.

    [ATTACH]n12585[/ATTACH] [ATTACH]n12586[/ATTACH] [ATTACH]n12586[/ATTACH] [ATTACH]n12586[/ATTACH] I was not sure what bit of script you wanted. Every time I hit the load button named "Home" or "Away" or "Load match 1" It reverts to "Nothing" and I cannot select any data.


    #DashBoard


  • 4.  RE: Dropdown Issue

    Posted 06-07-2017 14:12

    Okay. The problem is that you are using an INT_CHOICE_CONSTRAINT when your data has name-based IDs. If you look at your screenshot, all of your numeric values (the actual value of the parameter) are being set to "0" because "Sothern Ham", "North", "East", and "West" are not numbers...

    2 ways around this:
    Switch your parameter from an INT16 to a STRING and switch from INT_CHOICE to STRING_STRING_CHOICE for your constraint.

    var xmlDocument = ogscript.parseXML('teamdata.xml');         //Parse the XML
    var nodeList = xmlDocument.getElementsByTagName("team"); //Get the tags we want to include in the constraint
    
    var constraintData = [];   //Placeholder for the new constraint data
    
    if (constraintData.length == 0)  //Placeholder if we don't have anything (OPTIONAL)
    {
       constraintData.push({"key": " ", "value": "Nothing"});
    }
    
    for (var i = 0; i < nodeList.getLength(); i++)           //Loop through each tag we found
    {
       var node = nodeList.item(i);                          //Get the node
       constraintData.push({"key": node.getAttribute("AID"), "value": node.getAttribute("AID")});  //Push the key/value pair
    }
    
    
    var constraint = params.createStringStringChoiceConstraint(constraintData);   //Create the constraint
    params.replaceConstraint("a.tickerlogo", constraint);         //Replace the constraint

    OR

    Only put the names in the array and let DashBoard auto-generate the numbers (not as good if your list ever changes/reorders)

    var xmlDocument = ogscript.parseXML('teamdata.xml');         //Parse the XML
    var nodeList = xmlDocument.getElementsByTagName("team"); //Get the tags we want to include in the constraint
    
    var constraintData = [];   //Placeholder for the new constraint data
    
    if (constraintData.length == 0)  //Placeholder if we don't have anything (OPTIONAL)
    {
       constraintData.push("Nothing");
    }
    
    for (var i = 0; i < nodeList.getLength(); i++)           //Loop through each tag we found
    {
       var node = nodeList.item(i);                          //Get the node
       constraintData.push(node.getAttribute("AID"));  //Push the key/value pair
    }
    
    
    var constraint = params.createIntChoiceConstraint(constraintData);   //Create the constraint
    params.replaceConstraint("a.tickerlogo", constraint);         //Replace the constraint

    #DashBoard


  • 5.  RE: Dropdown Issue

    Posted 06-07-2017 14:14
    A copy of the panel with "ticker logo" switched to a STRING_STRING_CHOICE
    #DashBoard


  • 6.  RE: Dropdown Issue

    Posted 06-07-2017 14:30
    Hi James, thank you very much. I will give this a go.
    #DashBoard


  • 7.  RE: Dropdown Issue

    Posted 06-07-2017 15:15

    Hi James

    I do not quite understand where I need to change it to a string in the parameters. While keeping it a dropdown. I have attached a screenshot, nor string or string array allow me to keep the dropdown 


    #DashBoard


  • 8.  RE: Dropdown Issue

    Posted 06-07-2017 15:43

    Once you select STRING, you should be able to select String Key/Value constraint to get the dropdown list option back.


    #DashBoard


  • 9.  RE: Dropdown Issue

    Posted 06-07-2017 15:57
    Hi James

    That's done the trick.

    Thanks million
    #DashBoard


  • 10.  RE: Dropdown Issue

    Posted 06-08-2017 08:39

    Hi James

    Unfortunately it seems as though I can only select the first name on my dropdown. I have attached screenshots to help my explanation. 


    #DashBoard