Solved

Test a value

  • 13 December 2021
  • 8 replies
  • 11 views

Badge

Hello there,

 

So I have two attributes: "Floor" and "Purpose".

 

Floor Purpose

1 Lobby

2 Restaurant

3 Swimming pool

 

So I want to verify the dataset. If the "Floor" is 1, "Purpose" must be lobby. May I ask what kind of transformer I should use?

 

Thank you very much.

icon

Best answer by ebygomm 13 December 2021, 10:27

View original

8 replies

Userlevel 6
Badge +32

You can use a Tester to do this. One of the most used transformers.

Floor != 1 OR ( Floor = 1 AND Purpose = Lobby )

TesterParameters

Userlevel 1
Badge +10

I'd probably use an AttributeValueMapper followed by a tester to save having to write a complicated conditional in the tester, especially if you have an external data source with the allowed values which can be imported into the AttributeValueMapper

 

So use the AttributeValueMapper to map the floor value to a new attribute called TestPurpose or similar, followed by a tester to check that TestPurpose = Purpose

image

Userlevel 4
Badge +25

You can use a Tester to do this. One of the most used transformers.

Floor != 1 OR ( Floor = 1 AND Purpose = Lobby )

TesterParameters

I actually prefer the TestFilter over the Tester for the following reasons:

  • It allows you to perform multiple tests in a single transformer, rather than chaining mulitlple Testers in a row
  • It allows you to rename the output ports, which is a good idea with regards to Best Practices.
Badge

Thank you all for your help. Now my data it seems a little bit more complicated than I thought.

 

I have 3 data sets.

 

1) Floor (2 attribute = Floor & FloorID)

Floor = 1, 2, 3, 4, 5 ....

FloorID= a series of number

 

2) Units (2 attributes = FloorID & Carpark type)

FloorID = a series of number

Carpark type = 15-01, 15-02, 15-03, 16-01, 16-02, 17-01, 17-02 ....

 

3) Excel (Carpark group)

Carpark type: 15-01, 15-02, 15-03, 16-01, 16-02

 

Here is what I need to do.

1) Extract "Floor" data that are floor "5", with all the FloorID

2) Use the selected FloorID to find all the units that matched.

3) Compare selected data (Step 2) with the excel to check if it is in the range.

 

Thank you in advance.

 

Have a good day.

 

Userlevel 4
Badge +25

Thank you all for your help. Now my data it seems a little bit more complicated than I thought.

 

I have 3 data sets.

 

1) Floor (2 attribute = Floor & FloorID)

Floor = 1, 2, 3, 4, 5 ....

FloorID= a series of number

 

2) Units (2 attributes = FloorID & Carpark type)

FloorID = a series of number

Carpark type = 15-01, 15-02, 15-03, 16-01, 16-02, 17-01, 17-02 ....

 

3) Excel (Carpark group)

Carpark type: 15-01, 15-02, 15-03, 16-01, 16-02

 

Here is what I need to do.

1) Extract "Floor" data that are floor "5", with all the FloorID

2) Use the selected FloorID to find all the units that matched.

3) Compare selected data (Step 2) with the excel to check if it is in the range.

 

Thank you in advance.

 

Have a good day.

 

First a TestFilter or Tester to select floor 5, then a FeatureMerger to join that to the Units. Then the Merged output from that into another FeatureMerger to join it to the Excel and see what's merged/unused.

Badge

First a TestFilter or Tester to select floor 5, then a FeatureMerger to join that to the Units. Then the Merged output from that into another FeatureMerger to join it to the Excel and see what's merged/unused.

Thank you very much.

So I still have a minor problem. I am able to merge the floor and unit.

 

Lets say

Floor Type (Unit)

1/F 1-01, 15-01, 15-02 ...

2/F 1-01 , 2-01 ...

 

On each floor, I am able to find all the types (Unit) and store those in the "list". If there are one type (unit) is matched with the excel list on each floor. Then it is ok. My final goal is to find out which floor that the types (unit) are not on the excel.

 

This image shows what I got so far. Do I need to use "ListExploder" to explode the list first?

 

Thank you

 

sample 

Userlevel 4
Badge +25

First a TestFilter or Tester to select floor 5, then a FeatureMerger to join that to the Units. Then the Merged output from that into another FeatureMerger to join it to the Excel and see what's merged/unused.

Yes, you'll need to explode that list to separate features if you want to use it in a FeatureMerger

Badge

First a TestFilter or Tester to select floor 5, then a FeatureMerger to join that to the Units. Then the Merged output from that into another FeatureMerger to join it to the Excel and see what's merged/unused.

Got it, thank you very much! Merry christmas and happy new year! :)

Reply