cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Unable to filter infotable inside foreach/for loop ?

akesana
1-Newbie

Unable to filter infotable inside foreach/for loop ?

Hi,

We have two infortables

infotable1 contains 50 records

infotable2 contains 3 records we want to get maching records of all in for each way. Please find below logic we have written

var tableLength = infotable1 .rows.length;

   

    for(var z = 0; z < tableLength; z++)

    {

       

        var row=infotable1.rows;

       

var params = {

     fieldName: "source_number" /* STRING */,

      isCaseSensitive: undefined /* BOOLEAN */,

      t: infotable2 /* INFOTABLE */,

      value: row.source_number /* STRING */   // If I pass this I am getting empty result if I pass hardcoded value it works fine

   };

   // result: INFOTABLE

  var result = Resources["InfoTableFunctions"].EQFilter(params);

       

    }

Colud you check is anything worng in my code?

Thanks

Anil Kesana

5 REPLIES 5

Try Intersect Snippet instead

Hi Carles,

Thanks for your quick response, I have tried but not worked source_number in both table is string.

we need to filter based on that string field of every row of infotable1 and get matcing row of infotable2

Thanks

Anil Kesana

Hi Anil,

With Intersect snippet you will need something like:

var result = Resources["InfoTableFunctions"].Intersect({

  columns1: "",

  columns2: "*",

  joinType: "INNER",

  t1: infotable1,

  t2: infotable2,

  joinColumns1: "source_number",

  joinColumns2: "source_number"

});

Hi Carles,

Thanks Carles, It  worked for me I would like to check and condition on multiple columns is is it  possible like below?

  1. var result = Resources["InfoTableFunctions"].Intersect({ 
  2.   columns1: ""
  3.   columns2: "*"
  4.   joinType: "INNER"
  5.   t1: infotable1, 
  6.   t2: infotable2, 
  7.   joinColumns1: "source_number"&&"plant_id"&&"note_id"
  8.   joinColumns2: "source_number"&&"plant_id"&&"note_id"
  9. }); 

I got weird result when execute the above the code, how to check and condition ?

Thanks,

Anil Kesana

Separate columns by commas

Top Tags