Channel aliases
Give a channel a different name inside one range.
A range can give a channel an alias: a name that
applies only in that range. Use an alias to give a channel a clear name for one test,
for example tank_pressure for the input daq_analog_input_1.
Set an alias
Console
Python
TypeScript
- In the ranges toolbar, right-click a range that is saved to the Core and select Set as active range.
- In the channels toolbar, right-click a channel and select Set alias under followed by the range name.
- Type the alias, then press Enter.
The channels toolbar shows the alias while its range is active.
burst_test = client.ranges.retrieve(name="Oct 10 Burst Test")
burst_test.set_alias("daq_analog_input_1", "tank_pressure")
# Set several aliases at once
burst_test.set_alias({"daq_analog_input_2": "tank_temperature"})const burstTest = await client.ranges.retrieve("Oct 10 Burst Test");
await burstTest.setAlias("daq_analog_input_1", "tank_pressure");
// List the aliases of the range, keyed by channel key
const aliases = await burstTest.listAliases();A child range uses the aliases of its parent. Set an alias on the child to replace the alias of the parent in the child.
An alias applies only in its range. Outside of the range, Synnax does not find the channel by its alias.
Remove an alias
Console
TypeScript
Make the range active. In the channels toolbar, right-click the channel and select Remove alias under followed by the range name. You can select several channels first.
const channelKey = await burstTest.resolveAlias("tank_pressure");
await burstTest.deleteAlias(channelKey);The Python client cannot remove an alias.
Read by alias
Python
TypeScript
Use the alias as a property or a key of the range. The result is the data of the channel in the range:
burst_test = client.ranges.retrieve(name="Oct 10 Burst Test")
pressure = burst_test.tank_pressure.to_numpy()
pressure = burst_test["tank_pressure"].to_numpy()
# A regular expression matches channel names and aliases
for ch in burst_test["^tank"]:
print(ch.name, ch.to_numpy().max())Resolve the alias to a channel key, then read the time range of the range:
const burstTest = await client.ranges.retrieve("Oct 10 Burst Test");
const channelKey = await burstTest.resolveAlias("tank_pressure");
const data = await client.read(burstTest.timeRange, channelKey);