Skip to main content
Question

Hello, I have this list (see image): the Business RulesID & their count. I would like to add to this list all Business Rules IDs that are within the range of 1 to 25 & whose count is 0 (that's why their are missing),e.g. BusinessRuleId =4 & count=0

  • September 30, 2020
  • 4 replies
  • 4 views

katt
Supporter
Forum|alt.badge.img+12
  • Supporter

Capture

4 replies

hkingsbury
Celebrity
Forum|alt.badge.img+51
  • Celebrity
  • October 1, 2020

One option (there are a few) would be to start with a Creator and sent the Number to Create to 25. This will give you 25 features with an attribute '_creation_instance' from 0-24. Then pass it to an attributemanager and configure it so you rename '_creation_instance' to 'BusinessRuleID' (optional) and add one to the value and add a new attribute called 'Count'Screenshot 2020-10-01 150329

 

Then connect this to an featuremerger through the supplier port and connect your existing data to the requester port. Set the join on to BusinessRuleID (or _creation_instance for the supplier) for both. Make sure 'conflict resolution' is set to 'use requester'

 

Screenshot 2020-10-01 150739


katt
Supporter
Forum|alt.badge.img+12
  • Author
  • Supporter
  • October 1, 2020
hkingsbury wrote:

One option (there are a few) would be to start with a Creator and sent the Number to Create to 25. This will give you 25 features with an attribute '_creation_instance' from 0-24. Then pass it to an attributemanager and configure it so you rename '_creation_instance' to 'BusinessRuleID' (optional) and add one to the value and add a new attribute called 'Count'Screenshot 2020-10-01 150329

 

Then connect this to an featuremerger through the supplier port and connect your existing data to the requester port. Set the join on to BusinessRuleID (or _creation_instance for the supplier) for both. Make sure 'conflict resolution' is set to 'use requester'

 

Screenshot 2020-10-01 150739

There is no way to add the missing ones using a python caller for example?


debbiatsafe
Safer
Forum|alt.badge.img+20
  • Safer
  • October 1, 2020

Hi @katt​ 

It is definitely possible to do this using Python in the PythonCaller. For example, you can use this logic in the PythonCaller to create the output that you want.

 

However, it is generally recommended only use Python if there are no suitable transformers for the task. As @hkingsbury​ mentioned, there are a few workflows which can create the output wanted. For example, attached is a workspace which has two different methods to add the missing features.

 

Is there a reason why you want to use Python?


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • October 2, 2020
katt wrote:

There is no way to add the missing ones using a python caller for example?

Is there a reason you want to use a pythoncaller?

Creating 25 records with a count of 0 numbered 1 through 25 and then aggregating by business rule and summing the count will get the result you want

Capture


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings