Data Array Actor refuses to see value as value, insists it's a string
-
I'm having an issue with the Data Array actor refusing to see one of my data columns as a value, not as text.
No matter what I do I cannot get it to mutate to the correct thing, to output a value not a string.
[I've created this patch for auto-formatting and vertical centering captions from a script, with different fonts / colours for different actors etc etc.]
Can someone please have a look and see if they can spot the issue?
I've attached the patch with the relevant text file
The problem is in the 7th column of the .txt file, which is definitely a number but the Data Array Actor is insisting on reading it as a 'string'.
I've made certain the .txt file is UTF8.
Getting close to my wit's end about this
Thanks
Mark (not Mark, he'd know what to do!)
captions_test.zipPS Is there no way to force the Data Array actor into seeing a particular data type? eg text or integer etc?
-
I opened the TXT file on Notepad++ showing all characters, and I saw that the 7th column had a number followed by a space in all cases (or it appeared it was all of them). So I opened the file in Excel, clicked on the data in the 7th column to ensure I didn't see any spaces, then exported it as a tab-delimited TXT file again.
Using this new file, I disconnected the 7 value output, triggered the Data Array to read the new file, and then connected the 7th value to a value input on a Calculator. This mutated the output to float, and got it working as expected. What did NOT update was the label on the 7th value output, this still reads 'string 7' on the Data Array.
Note: somewhere in the mix I played with changing the first rows 7th value to a float, so 4.0 instead of 4, thinking that this might be used to define the types.. not sure if this helped me get it mutated correctly.I believe the hidden spaces where making those items be seen as text.
You can see the spaces in the file (as seen in Notepad++) below. -
I entered a bug regarding the output label not updating once the data in the TXT had the trailing space removed.
-
Thanks, Ryan, for your speedy assistance.
Very odd that space, which I did not see, even in Notepad++ (could be time for new glasses!). The spreadsheet column entry was the result of a calculation (how many previous columns had text in) and was formatted for number with no decimal places…
Anyhow, late here even for me: will check out your solution in the AM.Thanks again
Mark
-
Hi Ryan
There's definitely some strange behaviour going on with a) Isadora's initial assessment of an item's (spreadsheet's columns) content (value or string) and b) its consistency in maintaining that original assessment and c) indicating on the right hand side of the Data Array actor whether the output is value or string.
I'm hard against a deadline, but next week will interrogate this further and see if I can find the logic in this.
Meanwhile the entry for the Data Array Actor in the manual is slightly out of date: doesn't show or give info on the 'local copy' item. (pg 334)
Cheers
Mark -
@mark_m said:
Meanwhile the entry for the Data Array Actor in the manual is slightly out of date: doesn't show or give info on the 'local copy' item. (pg 334)
Most of the Actor and Control entries in the manual are very out of date. We're currently working on updating the manual though.
-
@mark_m said:
No matter what I do I cannot get it to mutate to the correct thing, to output a value not a string.
You can also always just place a JavaScript actor, go inside it, remove the "+1", then connect a value formatted as text to the input and connect something that needs that value as a number to the output: https://recordit.co/sqBuW2b1lx
This method also strips out leading and trailing spaces so text coming in as "2" (2 as text), " 2" (space before), "2 " (space after), or " 2 " (space before and after) would all just result in an output of "2" as a number.
Here's your file with that workaround in place: captions_test_javascript.zip
@mark_m said:
PS Is there no way to force the Data Array actor into seeing a particular data type? eg text or integer etc?
Yes. The Data Array actor's outputs are mutable, so you can mutate them from text to float/integer. However, mutable inputs and outputs cannot mutate while you've got them connected to something so you'd need to disconnect it from anything else it's connected to so that you can connect it to a non-mutable actor with the desired data type like a Calculator (float) or Counter (integer) to mutate the Data Array's output from text to float/integer. Then, while keeping it connected to that actor (so that it can't mutate again) you'd re-connect the Data Array's output to what you previously had it connected to.
-
I made the same thing with a macro/User actor:
Works like the Javascript with spaces and not with other characters like , . : a b
Best regards, Jean-François
-
Thanks @Woland for that explanation of how to get the output to mutate (?!) to the right sort of data. That's really useful, and thanks also for the javascript explanation. Also invaluable in the current circumstances with the ol' clock ticking.
Thanks @jfg for the user actor! Very useful!
When I've got this show up and running I'll make the captions file available to all properly commented.
Once set up it's a really fast way to create a load of captions very quickly which auto-selects fonts and colours for a number of different 'speakers'.