Hi, I’m working on a project where I have to use a text file, extract only some values and save them in variables.
In the file txt I’ll attach for example there is the line called “Marca”: I need to extract in a variable the value Honda associated to it. (The same for the successive rows in the file .txt)
Is there someone so kind who wants to help me?
Hi @CamiCat,
use Read Text File activity to get the string value.(strvalue)
split the string value using Environment.NewLine strvalue.Split(Environment.NewLine.ToArray, StringSplitOptions.RemoveEmptyEntries)
using build data table activity to create the table (variable,value)
assign the odd the values into the variable column even values to values field.
so you will get the datatable from here you can get the value.
Regards,
Arivu
Thank you so much.
How can I build the datatable with all the pairs of (variables,values)?
In particular, how can I assign the odd values to the variable column?
Thank you so much,
Camilla.
I created the datatable but I can’t loop for the elements of the array in ordet to insert the variables and the corresponding values.
Can you please help me?
I have to get the project finished in a short time.
Thank you,
Camilla.
@Dominic Thank you so much.
How can I add the odd values of the array to the previously created first column?
Maybe i can use: datatablename(index)(“column name”)=item?
Thank you so much,
I’ll refer to similar posts.
can you refer this post this may be helpful for you.
Read the text file and get it into string value.
i hope you know the header value you want to extract only the value fields from the notepad.
refer the above post to get the answer.
in regex we can split the data.
How can I do to extract only the charactersin bold? Valore Assic. 2700 € - JAZZ 1.2 I-VTECValore Assic. 4000 € - JAZZ 1.2 I-VTEC ELEGANCEValore Assic. 2700 € - JAZZ 1.2 I-VTEC VSAValore Assic. 4000 € - JAZZ 1.2 I-VTEC ELEGANCE VSAValore Assic. 2700 € - JAZZ 1.2 I-VTEC LEValore Assic. 4000 € - JAZZ 1.2 I-VTEC ELEGANCE LE
Thank you so much
Use Matches activity
Properties
Input : “your input String”
Pattern : (.*(?=Valore Assic))
Result: iEnumResult ->IEnumberable
after that use assign activity to get the data
strFrom=iEnumResult (0).ToString()