How to check if an input port is connected in a custom block

Product/components used and 10.18.0.2 level:

Detailed explanation of the problem: While creating custom analytics block with multiple inputs, how to check if wire is connected to an input port of the block, so that as per connected input port, operation/ processing can be performed. Input type is some measurement values not Boolean.

Error messages / full error message screenshot / log file:

Question related to a Partner Tenant, or to a production (partner) instance

@Harald_Meyer ,
Please suggest.

I’m trying to create a block with 5 input ports and the processing should happen only if input port is connected to wire.
Similar to AND block

Hi,

You can use $base.getInputCount(inputName). This returns 0 if no wire is connected to the input port.

So if your process action looks something like following:

action $process(any $input_myInput1, ...) { ... }

You need to call the action with name “myInput1” → $base.getInputCount("myInput1").

See the bullet points towards the end of the page - https://github.com/SoftwareAG/apama-analytics-builder-block-sdk/blob/rel/10.18.0.x/doc/010-BasicBlocks.md

Thanks,
Gyan

2 Likes

Thank you @Gyanendra_Singh_Baiswar

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.