I want to use byName() and byNames() in my flow.But I am not getting exact usage of it like am not finding any examples / scenarios . The Examples given by Azure are not clear. Please help .
CodePudding user response:
byName()searches for a column in a given stream name (stream name is optional). Look at the following example. Let's say you have source data as in the following image:

- I have added another column called team with value as
ogusing derived column transformation.

- Now consider you want to populate a column based on whether it exists or not. If there is no column with given name,
nullvalues are returned. I used the following dynamic content inderivedColumn1transformation,
toString(byName('team'))

- I get the following output:

Since we have given
teamas a column, it populated each row ofnewcolumn with correspondingteamcolumn value. Instead of givingteam, if we give any other column name that does not exist, then the entirenewcolumn will be populated with NULL values.byNames()is similar tobyName(). Instead of giving a single column, you give an array of column names. The following dynamic content is an example where I have given array of column names, along with stream (optional argument).
array(byNames(['gname','team'],'source1'))

- I got the following output:

- Here I am searching for columns
gname and teamin the streamsource1(which has only id and gname columns). Since we are looking to get a column where it does not exist, it has populated thenewcolumn withNULL. If all the given column names exist, the values are populated accordingly.
