Skip to main content
Solved

Test a value

  • December 13, 2021
  • 8 replies
  • 43 views

Forum|alt.badge.img

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.

Best answer by ebygomm

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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

8 replies

nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2938 replies
  • December 13, 2021

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

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

TesterParameters


ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • Best Answer
  • December 13, 2021

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


redgeographics
Celebrity
Forum|alt.badge.img+59
  • Celebrity
  • 3700 replies
  • December 13, 2021

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.

Forum|alt.badge.img
  • Author
  • 53 replies
  • December 14, 2021

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.

 


redgeographics
Celebrity
Forum|alt.badge.img+59
  • Celebrity
  • 3700 replies
  • December 14, 2021

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.


Forum|alt.badge.img
  • Author
  • 53 replies
  • December 23, 2021

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 


redgeographics
Celebrity
Forum|alt.badge.img+59
  • Celebrity
  • 3700 replies
  • December 23, 2021

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


Forum|alt.badge.img
  • Author
  • 53 replies
  • December 24, 2021

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! :)