Home

R035 Expression Filter Production


Outline

Filters all samples that don't match a given expression.

Platforms:
32/64bit 32/64bit 32/64bit
Requirements:
  • None
Known limitations:
  • None
Status:
  • Stable
Input signals:
  • 1 signal of any type.
Output signal:
  • Signal of the same type as the input.
Parameters:
  • Domain base: Domain base of the resulting signal.
  • Domain range: Domain range of the resulting signal.
  • Member: Select the member name or index in case of array or struct signals. If left empty, the filtering is performed on the total value.
  • Filter: Enter the filter definition. If left empty, no filtering is performed.
  • Keep tags: The output samples shall keep the tag information of each input sample.
  • Ignore 'None' samples: Ignore 'None' samples of the input signals.
  • Keep attachments: Check to keep labels and relations of each input sample.
  • Keep groups: Check to keep the group information (e.g. transactions) of each input sample.


Input Signal Configuration

The production accepts signal of any type.

Primary Source
The primary source is the first source signal of the production.



Output Signal Configuration

Productions are executed on the fly, as soon as the signal data is required for further processing, and re-executed when settings or input signal have been changed. Before executing a production, the system needs to know the source signals, the type and the domain of the signal. All these informations need to be entered into the plot configuration dialog. If you leave the configuration fields empty, impulse tries to extract the information from the sources. The fields will display this information in light gray <e.g. Derived(Time)>. 

The production creates a signal of the same type as the input. Just the domain can be modified.

Domain Class/Base
The domain base is just required if your output signal has a different domain than the source signals. If not, just don't touch these settings.
Domain Range
Use this field to set the domain range, so the minimum and maximum value of the domain (e.g. 0 .. 1000 Hz)


Production Configuration

  • Member: Select the member name or index in case of array or struct signals. If left empty, the filtering is performed on the total value.
  • Filter: Enter the filter definition. If left empty, no filtering is performed.

In case of Struct signals, enter the member name or id of the member. In case of Array signals, enter the member name or index of the member.

The id defines the position of the member definition, whereas the index means the position of the value. Only in case of arrays, id and index are equal.

Example with members (id/member name):

  • 0: A
  • 1: B
  • 2: C

Struct

  1. 0: data; 1: data
  2. 1: data; 3: data (data index and member id not identical)
  3. 0: data;
  4. 0: data; 1: data; 2:data

Array

  1. 0: data; 1: data; 2:data (data index and member id identical)
  2. 0: data; 1: data; 2:data
  3. 0: data; 1: data; 2:data

The filter definition can be either a text fragment, a regular expression or a numeric expression.

  1. Filter samples using a text fragment
    • abc: Show sample if text contains 'abc'
  2. Filter samples using a regular expression - Indicate with any of: '[](){}|?*^$.'
    • ab[0-9]n? : ... if text matches 'abc0n', ....
  3. Filter samples using a numeric expression
    • 0.4 < 2.0: Show sample if value matches range - use float or integer numbers (e.g. 0.1; 12 ; 0x300)
    • < 0x400: ... if value less than argument
    • <=-4: ... if value less or equal than argument
    • > 2.7: ... if value greater than argument
    • >= 0.04: ... if value greater or equal than argument
    • == 1000: ... if value equals argument


Signal Handling

  • Keep tags: The output samples shall keep the tag information of each input sample.
  • Ignore 'None': Ignore 'None' samples of the input signals.
  • Keep attachments: Check to keep labels and relations of each input sample.
  • Keep groups: Check to keep the group information (e.g. transactions) of each input sample.

The signal handling flags give the user more control over the output signal generation. If the "Keep tags" is checked, the output samples will get the tag information of each input samples. The "Ignore None" flag let the production ignore 'None' input samples.

If "Keep attachments" is checked, the attachments of the input samples (label, relation) will preserve in the output samples.

If "Keep groups" is checked, the group information of the input samples (group, order, layer) will preserve in the output samples.



Operation

Below you find the operation code for the production.

	
	// iterate
	while (iter.hasNext() && !isCanceled()) {           
	
	    // value
	    iter.next();
	    CompoundValue cvalue = input.compound();
	    if (cvalue == null)
	        continue;
	
	    // none sample
	    boolean hasMember = member != null && cvalue.hasMember(member);
	    boolean isNone = cvalue.isNone() || (member != null &&  !hasMember);
	    if (ignoreNone && isNone)
	        continue;
	
	    // filter
	    String fval = (isNone || filter == null) ? null : member == null  ? cvalue.stringValue() : cvalue.stringValueOf(member);
	    boolean hit = filter != null ? filter.matches(fval != null ? fval : "") : true;
	
	    // write
	    if (hit) {
	        if (!keepTags)
	            cvalue.setTagged(false);
	        if (!keepGroups)
	            cvalue.setOrder(ISample.GO_NONE);
	        if (!keepAttachments)
	            cvalue.setAttachments(null);
	        targetWriter.writeSample(cvalue);
	    }
	}
		
                

toem

technical software and tooling

Company

Contact Us

This email address is being protected from spambots. You need JavaScript enabled to view it.