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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

How to get a table of distinct rows with all columns

Pankajphopse1
11-Garnet

How to get a table of distinct rows with all columns

Hello , can anybody help me?

I am getting the repeated data of perticular characterisrtics but i want data distinctly but not only columns but also a row.If anyone knows the solution then please revert back. I tried using distict but it only give column not rows.

for example: I am having following table attached in image

 

now If we distict the table using ProcessID and PartID then table must be attached in image

 

The table must show the same values of the same row.

 

Thanks,

Pankaj Phopse

1 ACCEPTED SOLUTION

Accepted Solutions

Please follow the steps

1. Query the stream(info1)

2. Create an infotable with the mentioned fields(info2)

3. Add first row of stream to that infotable;

4. Put a loop(i) where the loop length is stream length.

5. Put a second loop(j) inside the first loop for which the loop length is new infotable length.

6. Put a condition to check whether the stream part id and process id is same as that of the values in the infotable.

eg: if(info1.rows[i].Part == info2.rows[j].Part && info1.rows.Process == info2.rows[j].Process)

                break;

      else

                Add data to infotable

 Try it!!!

View solution in original post

5 REPLIES 5

Hello,

 

Can you provide some further detail of your expected result here? I'm not quite sure what you mean.

 

Thank you,

 

-- Craig A.

pkushwaha
6-Contributor
(To:CRArko)

Hello, 

   Lets take an example I have one stream which stores the data. In the stream columns are Part,Process,ActaulValue and Deviated Value. Now in the stream the data is of 100 rows in that the part ID and Process ID are diffrent like I have 5 Processes suppose A,B,C,D,E and Part are F,G,H,I,J.

Now in the table I am getting duplicated data  accordingly. Now I dont want the duplicated data of the same Process and Part, for example if Process A in the table is 5times and the data accordingly like:

 

row Process  PArt  Actual  Deviated

1.    A              F     10       15

2.    A              G    11       16

3.    A             G     12       17

4.    C              F     13       18

5.    B              F     10       19

 

Now in the above table A is repeated 3 times but I want this A must be unique according to part like:

1.  A  F 10 15

2. A  G 11 16

3. C  F  13 18

 

Like for the same Part and Process it should not repeat I want each row must be distinct.

 

 

Thank you.

Please follow the steps

1. Query the stream(info1)

2. Create an infotable with the mentioned fields(info2)

3. Add first row of stream to that infotable;

4. Put a loop(i) where the loop length is stream length.

5. Put a second loop(j) inside the first loop for which the loop length is new infotable length.

6. Put a condition to check whether the stream part id and process id is same as that of the values in the infotable.

eg: if(info1.rows[i].Part == info2.rows[j].Part && info1.rows.Process == info2.rows[j].Process)

                break;

      else

                Add data to infotable

 Try it!!!

Its working 

Thank you Yedukrishnan!!!

Hi Yedukrishnan & team,

 

I am new to Thingworx and learned alot, but still i am facing with few calculations.

I have following value continuously getting from machine,  i have few column names with tag_name, value, timestamp, tag_value (0 or 3), part_count(0 or 1), I would like to calculate cycle time and its logic is : when tag_value is 3 till next 0 with part_count 1 = cycle time for each part produce. I have mentioned bellow and attaching screenshot for more clearance .

Can you plz help me on calculation part, I will really appreciated plz. 

 

Formula is :
cycle time = end time - start time  [described in screenshot.]

 

tag_name         value        timestamp           tag_value     part_count
Auto Operate   TRUE     1524031961524          0                   0
Auto Operate   TRUE     1524031963530          0                   0
Auto Operate   TRUE     1524031963530          3                   1
Auto Operate   TRUE     1524031964530          3                    1
Auto Operate  TRUE     1524031965528          3                   1
Auto Operate  TRUE     1524031966529          3                    1
Auto Operate  TRUE    1524031967524          0                    0
Auto Operate  TRUE    1524031968530         0                    0
Auto Operate  TRUE    1524031969526          0                    0
Auto Operate  TRUE     1524031967524          3                    1
Auto Operate  TRUE     1524031968530          3                    1
Auto Operate  TRUE     1524031969526          3                    1
Auto Operate  TRUE     1524031967524          0                    0
Auto Operate  TRUE     1524031968530          0                    0
Auto Operate  TRUE     1524031969526          0                    0
Auto Operate  TRUE     1524031969526          0                    0
Auto Operate  TRUE     1524031969526          3                   1
Auto Operate  TRUE     1524031969526          3                   1

 

best Regards

Vikas

Top Tags