Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

iLogic How to Separate Values in a Text File?

Anonymous

iLogic How to Separate Values in a Text File?

Anonymous
Not applicable

Hi,

 

I am using iLogic to read a .txt file, although the file does not have comma separated values. How would I get iLogic to separate each word and number into separate variables?

 

I've spent a lot of time researching how to do this, but I haven't found much information. This is my first time using iLogic, so I am not familiar with a lot of its functions and capabilities. I've attached a view of the .txt file as well as my code.

 

Thank you.

Text File.PNGCode.PNG

0 Likes
Reply
1,585 Views
3 Replies
Replies (3)

Sergio.D.Suárez
Mentor
Mentor

Your code is fine, what happens is that you need to have well defined the separators of the strings, otherwise the task becomes more difficult. regards

 

oFile = "C:\Users\Sergio\Desktop\Example.txt"

oRead = System.IO.File.OpenText(oFile)

'read the file
oRead = System.IO.File.OpenText(oFile)
EntireFile = oRead.ReadToEnd()
oRead.Close()

'create aray from text info
'splitting at that comma
oSplit = Split(EntireFile, " ")

For Each wrd In oSplit
MessageBox.Show("Word Index #" & i & " = " & oSplit(i))
i += 1
Next

 


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Anonymous
Not applicable

Thank you for your help. I was able to get the message box to show up.

 

Is there a way to access those individual numbers and save them as custom iProperties?

 

Thanks.

0 Likes

johnsonshiue
Community Manager
Community Manager

Hi! I believe it should be doable. You just need to give the Custom iProperty a name and assign a value.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes