2016년 12월 2일 금요일

Cannot parse text argument to "list from csv row" as CSV-formatted row (sequel)


Taifun and ABG, the other post closed due to inactivity.
I'm very busy with school etc..

But as an answer on Taifun's post:

you can't use Do it together with local variables
as you can see, package $text does not help very much
this is, why ABG mentioned, what you can do to display the value of a local variable (for example in your File.GotText event)
"Add an extra global variable called TaskListText, initially blank.In the File TextGotten block, when the text arrives,capture it in the new TaskListText variable,and feed the new variable contents into the csv conversion block."See also Scott's tip How to use 'Do It' to view procedure results, event arguments and local variables.
and instead of providing 4 similar(?) confusing screenshots, what about providing only 1 screenshot with the relevant information?
Taifun 
I don't know what I'm doing, so I don't know if I'm doing something right or wrong...

The only result I'm getting is: Do It Result: (package $text)
As you can see with the attached image.

And if I'm using DoIt with the call.ReadFrom I get the error: "Cannot parse text argument to "list from csv row" as CSV-formatted row"

Is it me? Am I doing something wrong? Because I don't understand you guys precisely.. I'm sorry for that..

test4.png 표시 중

-- 
 Capture.png

You have it set up correctly. I think that the problem may be that you have not run the File_Tasks.ReadFrom block before testing the value of TaskListText.
Try right-clicking on the File_Tasks.ReadFrom block and choosing Do it. then go back to the get global TaskListText block and 'Do it' there. 
You should see a value returned then.

-- 
If I do that the value is: *empty string*

Also, when I click DoIt on the File_Tasks.ReadFrom block I get the error message.

-- 
It looks like the File_Tasks.GotText block is not executing.
Are you sure that your text file name //TL350.txt is correct and that the file is in fact a text file and not a binary file?

-- 
Yeah, I'm sure.

I made it with Notepad. Don't know how it made a binary file, if that is the problem? And how can I see if it that is true?

-- 
If you made it with Notepad, it will be a text file as that is the only format supported.
So this is another dead end...
Maybe send me the aia file or attach it here and I will test some scenarios?

-- 
It's gives me a headache :D

Thanks for your help anyways!
It is in scr_gekozen

Don't mind the names etc. I'm Dutch haha

Thanks in advance!


-- 
Maybe you should try the attached?
ABG
2016-04-03 19_00_39-MIT App Inventor 2.png 표시 중

-- 
Here is the debugged version...
I massaged your data file to remove any double quotes and substituted the ` character for apostrophes.
I also treat the file as a csv table rather than a csv row which will give an error when the data is on separate rows.
So you must use list from csv table.
So now each activity the player must perform is a single field value on each row in the list.
Use select list item to get the row in the list then select list item again to get the actual value from that row.


-- 
@Abraham
list from csv table throws an error also with his original text file.
There was a character or characters in his data file that was tripping up the conversion.
I removed any possible problem punctuation like " and ' characters inside the text of each row and surrounded each data row with double quotes to force each row to contain one field.
That seems to work.

-- 
Yes it works!

You have found the solution! I know now the problem... It was so simple..
As you said, the ' and " tripped the conversion. That was the only problem.

With your solution the tasks would display like this: (task).
That would be ugly. (but thanks for your help!)

I have edited the .txt file and changed ' and " into `. I also threat it like a row seperated with commas. It works! (I've also placed them as a row)

Thank you so freaking much! The app was almost finished, but this was the only problem..

So much thanks!!!!

-- 
To get rid of the parentheses around ( task ) use another select list item (listname, 1)


Happy Inventing!

-- 

댓글 없음:

댓글 쓰기