0

I have a query filter in my code, I want to pass these two queries as one like this:

 case1 
  con = {'eq':['case1':dosome]}
 case2
  con = {'eq':['case1':dosome]}

I need to bind these two at the end like this

{'eq':['case1':dosome],'eq':['case2':dosome]}

the key eq should remain same.

Pimgd
  • 5,865
  • 1
  • 28
  • 44
Mohamed Nizar
  • 770
  • 8
  • 27

4 Answers4

2

Why not use an object with two properties like

{ eq: { case1: dosome, case2: dosome } }
Nina Scholz
  • 351,820
  • 24
  • 303
  • 358
1

Sounds like you want an array of objects:

var your_array = new Array();
var con1 = {'eq':{'case1':dosome}}
your_array.push(con1)
var con2 = {'eq':{'case2':dosome}}
your_array.push(con2)

You can then use the methods for accessing parts of the array -> http://www.w3schools.com/js/js_array_methods.asp

jeffery_the_wind
  • 15,258
  • 34
  • 92
  • 158
0

Use merge() function. Also this will give error: ['case1':dosome]. Try this

<script>
var obj1 = {'eq':{'case1':dosome}};
var obj2 = {'eq':{'case2':dosome}}
var merge = obj1.merge(obj2);
</script>

Hope this helps

Utkarsh Dixit
  • 4,153
  • 3
  • 14
  • 36
0

You can try this:

{ eq: [
  { condition: 'case1', action: doSome } , 
  { condition: 'case2', action : doSomeOther }
]}
Morteza Tourani
  • 3,308
  • 5
  • 40
  • 48