Loading ...
Sorry, an error occurred while loading the content.

365Dynamic queries using javascript varible

Expand Messages
  • wokingojc
    Jul 3, 2012
    • 0 Attachment
      Here is the javascript cod I am working with.

      Basically I am trying to query the database upon a select box change. When it is change it fires off the value to the getConstruction function with it's type (awg or mm2).

      I then want to use these values to query the database but can't seem to get it to work.

      Any ideas please?

      var database = TAFFY([
      {id:1,awg:4,mm2:21.151,construction:"133 * (25)R",diameter:6.48,weight:197.9,ohms:0.09},
      {id:2,awg:6,mm2:13.302,construction:"133 * (27)R",diameter:5.14,weight:124.9,ohms:0.14},
      {id:3,awg:10,mm2:2.59,construction:"1 * (10)",diameter:2.59,weight:46.77,ohms:0.35},
      {id:4,awg:10,mm2:2.59,construction:"37 * (26) C",diameter:2.8,weight:44.43,ohms:0.38},
      {id:5,awg:10,mm2:2.59,construction:"91 * (30) U",diameter:2.7,weight:42.22,ohms:0.43},
      {id:6,awg:16,mm2:1.29,construction:"1 * (16)",diameter:1.29,weight:11.62,ohms:1.4},
      {id:7,awg:16,mm2:1.29,construction:"19 * (29) C",diameter:1.42,weight:11.41,ohms:1.49},
      {id:8,awg:16,mm2:1.29,construction:"19 * (29) U",diameter:1.36,weight:10.83,ohms:1.49},
      {id:9,awg:16,mm2:1.29,construction:"19 * 0.3 C",diameter:1.5,weight:12.5,ohms:1.36},
      {id:10,awg:16,mm2:1.29,construction:"19 * 0.3 U",diameter:1.43,weight:11.86,ohms:1.36},
      {id:11,awg:16,mm2:1.29,construction:"61 * (34)",diameter:1.45,weight:11.23,ohms:1.45},
      {id:12,awg:16,mm2:1.29,construction:"315 * (41) R",diameter:1.6,weight:11.8,ohms:1.47}
      ]);



      function getConstruction(column, value) {
      var str = {column:value};
      console.log(database(str).select("id"));
      }
    • Show all 2 messages in this topic