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
  • 8 views

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

Capture

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.

4 replies

hkingsbury
Celebrity
Forum|alt.badge.img+63
  • Celebrity
  • 1625 replies
  • 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
  • 41 replies
  • 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

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


debbiatsafe
Safer
Forum|alt.badge.img+21
  • Safer
  • 648 replies
  • 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+44
  • Influencer
  • 3427 replies
  • October 2, 2020

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