How do I read a location from a file

Hello all, I’m sorry if this has been brought up before but I can’t find anything. File and DB use are not straightforward at all. I want to pull out an item from a position from a list by number of position. Do I need to put it into a TinyDB and tag it? Thats seems like a lot of extra work. There has to be an easy method to pull this out right?

Welcone @Adam_Crane.
What have you tried to do? Do you have a list and want to pick up an item? Show us your blocks.

1 Like

Sorry, I didn’t realize that this actually posted I thought it got lost in the aether when I hit something accidentally. Are there any deep tutorials on files and tinyDB and how to get data out? The docs here are too generic and non-specific. I’ve scoured the net for more detail and no luck. I can’t be the only one with this issue. If there are no tutorials I’ll post the full problem here

What is your list? (1,2,3,4,5) ? ( ( 1,2,3), (4,5,6) ) ?
A set of lines?
What format is it in?
Want to remove an item? A line ?

Its a file, I’ve tried CSV and txt and neither have worked, I’ve tried converting a spreadsheet with and without a second numbered column. I’ve tried using list from CSV row, select list item, and index in list and nothing will pull an individual peice of data from location, its just tries to pull the entire peice out.
And I’ve tried converting the contents of the file to tinyDB using this method Tutorial TinyDB to File and back No luck

Here is the latest version i tried when that website I posted didn’t work.

Post the “Do it” result of this:

1 Like

… and see here:

I thought this post had failed to post.

It will post all the file. That works, the problem is pulling peices out by position.

Hi @Adam_Crane
Please post as much details as you can (including blocks and Do it result).

What does that mean?
Where’s the problem of posting the result of “Do it” here?
Connect to Companion → right mouse click on Label1.txt → “Do it
and post the result.

There are no options for do it, the file is pretty big. If I use a 2 row csv file I get
1, thing1
2, thing2

2 row txt file
1 thing1
2 thing2

One row txt or csv
thing1
thing2

image

This is something like how I would think you can pull out thing1, but it just throws an error with
Runtime Error

The operation select list item cannot accept the arguments: , [thing1 thing2],[1]

But how we can know what you are trying to parse

The result I’m hoping to get is thing1 because its in position 1 in the CSV or TXT. I’m probably asking it something the wrong way or asking it to do more than it can do.

I mean an example of your file’s text and what you want to extract from it.

Pick one from the list above. either type of CSV or TXT.

thing1
thing2
thing3

How would I take this text file containing these items and set say Label79.text to just thing1 instead of the entire list? That list in that format is what the list would show if I set the file to = Lable79.text

1.Plain Text
Example: item1 \n item2 \n item3
Split text at \n and select desired item.

2.CSV Text
Example: item1,item2,item3
Split text at , and select desired item.
Note: list from csv row block will not work here (according to my tests)

Ok I’ll try it out, Thanks

Thank you that worked. Was this listed somewhere? This felt like a really round about and not obvious way to do this at all. I’m sure I’m not the only one who had this problem. Thanks!