SOLVED

Select text from split function

%3CLINGO-SUB%20id%3D%22lingo-sub-2107699%22%20slang%3D%22en-US%22%3ESelect%20text%20from%20split%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2107699%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20hope%20someone%20can%20help%2C%20(I%20also%20hope%20I%20can%20explain%20this%20issue)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20created%20a%20pipeline%20to%20bring%20in%20a%20CSV%2C%20stick%20it%20in%20blob%20storage%20and%20then%20modify%20it%20and%20stick%20it%20in%20a%20sql%20database.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20while%20using%20data%20flow%20to%20help%20tidy%20the%20contents%20up%20I've%20come%20unstuck.%26nbsp%3B%20I%20created%20a%20derived%20column%20to%20split%20rdfsLabel%20which%20contains%20names%20of%20stuff%20in%20different%20languages.%26nbsp%3B%20Each%20separated%20with%20a%20%7C.%26nbsp%3B%20The%20issue%20is%20that%20there's%20no%20consistency%20with%20what%20order%20each%20language%20is%20in%20and%20each%20time%20I%20run%20the%20pipeline%20the%20order%20can%20change%20from%20source.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22outline%20issue.png%22%20style%3D%22width%3A%20780px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F250416i3EE99499C00AA1DF%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22outline%20issue.png%22%20alt%3D%22outline%20issue.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20someone%20give%20me%20pointer%20on%20how%20to%20populate%20a%20column%20with%20the%20text%20from%20the%20string%20with%26nbsp%3B%40en%20at%20the%20end%2C%20once%20I%20get%20this%20I%20can%20then%20duplicate%20this%20for%20each%20of%20the%20languages%20and%20then%20go%20in%20and%20create%20another%20derived%20column%20and%20trim%20out%20the%20language%20identifiers.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20hoping%20its%20something%20really%20silly%20that%20I've%20missed.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20advance%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJohn%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2112143%22%20slang%3D%22en-US%22%3ERe%3A%20Select%20text%20from%20split%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2112143%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F239814%22%20target%3D%22_blank%22%3E%40John%20Dorrian%3C%2FA%3E%2C%20there%20is%20no%20such%20thing%20that%20I%20do%20for%20this%2C%20but%20whatever%20I%20need%20to%20do%20or%20want%2C%20I'll%20just%20figure%20out%20the%20possible%20functions%20and%20logic%20and%20then%20hit%20and%20try%20the%20possible%20functions%20in%20the%20mapping%20data%20flow.%3CBR%20%2F%3EYou%20can%20follow%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fdata-factory%2Fdata-flow-expression-functions%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fdata-factory%2Fdata-flow-expression-functions%3C%2FA%3E%26nbsp%3Bexpression%20language%20as%20your%20reference%20guide.%3CBR%20%2F%3E%3CBR%20%2F%3EThanks%20and%20Regards%2C%3CBR%20%2F%3ESunaina%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2111856%22%20slang%3D%22en-US%22%3ERe%3A%20Select%20text%20from%20split%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2111856%22%20slang%3D%22en-US%22%3EThanks%20for%20this%20I%20was%20miles%20of%20and%20making%20derived%20columns%20of%20derived%20columns.%3CBR%20%2F%3E%3CBR%20%2F%3EAre%20there%20any%20resources%20you'd%20recommend%20using%20to%20get%20a%20better%20idea%20of%20what%20functions%20to%20use%20and%20when%2C%20or%20is%20it%20more%20a%20case%20of%20practice%20practice%20and%20practice%20with%20a%20lot%20of%20trial%20and%20error.%3CBR%20%2F%3E%3CBR%20%2F%3EKind%20Regards%3CBR%20%2F%3E%3CBR%20%2F%3EJohn%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2111214%22%20slang%3D%22en-US%22%3ERe%3A%20Select%20text%20from%20split%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2111214%22%20slang%3D%22en-US%22%3E%3CP%3EHey%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F239814%22%20target%3D%22_blank%22%3E%40John%20Dorrian%3C%2FA%3E%26nbsp%3B%2C%20tried%20the%20expression%20builder%20and%20here%20you%20go.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22regexp_adf.PNG%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F251382iC1A787CFE3E91B18%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22regexp_adf.PNG%22%20alt%3D%22regexp_adf.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22output_regexp_adf.PNG%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F251381i04B6540C7E244E6A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22output_regexp_adf.PNG%22%20alt%3D%22output_regexp_adf.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20this%20is%20what%20you%20were%20looking%20for%20and%20I%20might%20have%20resolved%20your%20issue.%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20so%2C%20kindly%20mark%20this%20reply%20as%20an%20answer%20or%20upvote%20here!%3CBR%20%2F%3E%3CBR%20%2F%3EThanks%20and%20regards%2C%3CBR%20%2F%3ESunaina%20Lalwani%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2110062%22%20slang%3D%22en-US%22%3ERe%3A%20Select%20text%20from%20split%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2110062%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F950022%22%20target%3D%22_blank%22%3E%40SLalwani%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20I%20did%20manage%20the%20split%20column%20part%20on%20the%20%7C%2C%20apologies%20I%20am%20a%20noob%20and%20couldn't%20find%20an%20index%20value%20from%20the%20list%20of%20expression%20elements.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20looked%20at%20the%20%22byitem%22%20and%20%22byname%22%20functions%20but%20can't%20see%20how%20to%20get%20these%20to%20select%20the%20entry%20with%20%40en%20in%20the%20string.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2109879%22%20slang%3D%22en-US%22%3ERe%3A%20Select%20text%20from%20split%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2109879%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F239814%22%20target%3D%22_blank%22%3E%40John%20Dorrian%3C%2FA%3E%26nbsp%3BNo%20need%20to%20do%20duplicacy%20over%20the%20column%2C%20you%20can%20create%20a%20new%20derived%20column%20from%20this%20as%20I%20assume%20you%20need%26nbsp%3B%40en%20as%20your%20values%2C%20so%20just%20split%20with%20'%7C'%20and%20then%20in%20the%20next%20step%20use%20another%20derived%20column%20to%20select%20an%20index%20value%20prior%20to%20'%40en'%20index%26nbsp%3Bfrom%20split%20array%20column%20from%20the%20previous%20step.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2109876%22%20slang%3D%22en-US%22%3ERe%3A%20Select%20text%20from%20split%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2109876%22%20slang%3D%22en-US%22%3EIf%20that's%20an%20easier%20workround%20to%20get%20started%20then%20yes%20if%20its%20a%20case%20of%20filtering%20by%20%40en.%20I%20have%20to%20say%20I'm%20just%20dipping%20in%20and%20out%20of%20Data%20Factory%20as%20the%20need%20arises%20but%20I%20really%20need%20to%20commit%20a%20lot%20more%20time%20on%20this.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20could%20then%20duplicate%20the%20original%20column%20and%20create%20another%20filter%20for%20%40cy%20when%20required.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2109868%22%20slang%3D%22en-US%22%3ERe%3A%20Select%20text%20from%20split%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2109868%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F239814%22%20target%3D%22_blank%22%3E%40John%20Dorrian%3C%2FA%3E%26nbsp%3B%2C%20I%20can%20see%20various%20values%20in%20the%20specified%20field%20as%20follows%20%2C%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3E'Asiantaeth%20Safonau%20Bwyd'%40cy%7C'Food%20Standards%20Agency'%40en%20%2C%0A'Adur%20District%20Council'%40en%2C%0A...%0A%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3BPlease%20confirm%20that%20you%20need%20to%20just%20filter%20out%20the%20substring%20which%20is%20depicting%20the%20language%26nbsp%3B%40en.%20%2C%20i.e.%2C%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E'Food%20Standards%20Agency'%0A'Adur%20District%20Council'%0A...%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3CBR%20%2F%3EFor%20your%20NOTE%3A%20datafactory%20doesn't%20like%20headers%20starting%20with%20'%40'%20%2C%20rather%20than%20creating%20a%20SQL%20table%2C%20you%20can%20just%20enable%20'skip%20n%20rows'%20to%201%20from%20blob%20dataset%20settings.%3CBR%20%2F%3E%3CBR%20%2F%3ERegards%2C%3CBR%20%2F%3ESunaina%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2109835%22%20slang%3D%22en-US%22%3ERe%3A%20Select%20text%20from%20split%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2109835%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F950022%22%20target%3D%22_blank%22%3E%40SLalwani%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIts%20an%20open%20data%20set%20and%20the%20link%20I'm%20using%20is%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdata.food.gov.uk%2Fcodes%2Freference-number%2Fauthority%3F_format%3Dcsv%26amp%3B_view%3Dwith_metadata%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdata.food.gov.uk%2Fcodes%2Freference-number%2Fauthority%3F_format%3Dcsv%26amp%3B_view%3Dwith_metadata%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20note%20datafactory%20doesn't%20like%20the%20%22%40id%22%20title%20so%20to%20get%20round%20this%20I%20created%20sql%20table%20and%20then%20deleted%20first%20row.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20was%20going%20to%20create%20another%20field%20called%20Name%2C%20and%20NameCY%20to%20put%20the%20content%20of%20the%20arrays%20but%20this%20is%20where%20I'm%20having%20issues.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20offering%20to%20look%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJohn.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2109695%22%20slang%3D%22en-US%22%3ERe%3A%20Select%20text%20from%20split%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2109695%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F239814%22%20target%3D%22_blank%22%3E%40John%20Dorrian%3C%2FA%3E%2C%20Can%20you%20share%20some%20sample%20records%20for%20this%20field%20from%20the%20source%20and%20the%20final%20targeted%20fields%20that%20define%20how%20do%20you%20want%20the%20data%20to%20be%20inserted%20in%20destination%20fields%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi hope someone can help, (I also hope I can explain this issue)

 

I created a pipeline to bring in a CSV, stick it in blob storage and then modify it and stick it in a sql database.

 

But while using data flow to help tidy the contents up I've come unstuck.  I created a derived column to split rdfsLabel which contains names of stuff in different languages.  Each separated with a |.  The issue is that there's no consistency with what order each language is in and each time I run the pipeline the order can change from source.  

outline issue.png

 

Can someone give me pointer on how to populate a column with the text from the string with @en at the end, once I get this I can then duplicate this for each of the languages and then go in and create another derived column and trim out the language identifiers.

 

I'm hoping its something really silly that I've missed. 

 

Thanks in advance

 

John

9 Replies

@John Dorrian, Can you share some sample records for this field from the source and the final targeted fields that define how do you want the data to be inserted in destination fields?

@SLalwani 

 

Its an open data set and the link I'm using is https://data.food.gov.uk/codes/reference-number/authority?_format=csv&_view=with_metadata 

 

To note datafactory doesn't like the "@id" title so to get round this I created sql table and then deleted first row.

 

I was going to create another field called Name, and NameCY to put the content of the arrays but this is where I'm having issues.

 

Thanks for offering to look

 

John.

@John Dorrian , I can see various values in the specified field as follows , 

'Asiantaeth Safonau Bwyd'@cy|'Food Standards Agency'@en ,
'Adur District Council'@en,
...

 Please confirm that you need to just filter out the substring which is depicting the language @en. , i.e., 

'Food Standards Agency'
'Adur District Council'
...

 
For your NOTE: datafactory doesn't like headers starting with '@' , rather than creating a SQL table, you can just enable 'skip n rows' to 1 from blob dataset settings.

Regards,
Sunaina

If that's an easier workround to get started then yes if its a case of filtering by @en. I have to say I'm just dipping in and out of Data Factory as the need arises but I really need to commit a lot more time on this.

I could then duplicate the original column and create another filter for @cy when required.

@John Dorrian No need to do duplicacy over the column, you can create a new derived column from this as I assume you need @en as your values, so just split with '|' and then in the next step use another derived column to select an index value prior to '@en' index from split array column from the previous step.

@SLalwani 

 

Thanks I did manage the split column part on the |, apologies I am a noob and couldn't find an index value from the list of expression elements.

 

I've looked at the "byitem" and "byname" functions but can't see how to get these to select the entry with @en in the string.

best response confirmed by John Dorrian (Occasional Contributor)
Solution

Hey @John Dorrian , tried the expression builder and here you go.

regexp_adf.PNG

output_regexp_adf.PNG

 

Hope this is what you were looking for and I might have resolved your issue.

If so, kindly mark this reply as an answer or upvote here!

Thanks and regards,
Sunaina Lalwani

Thanks for this I was miles of and making derived columns of derived columns.

Are there any resources you'd recommend using to get a better idea of what functions to use and when, or is it more a case of practice practice and practice with a lot of trial and error.

Kind Regards

John

@John Dorrian, there is no such thing that I do for this, but whatever I need to do or want, I'll just figure out the possible functions and logic and then hit and try the possible functions in the mapping data flow.
You can follow https://docs.microsoft.com/en-us/azure/data-factory/data-flow-expression-functions expression language as your reference guide.

Thanks and Regards,
Sunaina