I am trying to pass in the Label Annotations from a Google Vision connected system into an editable grid. When I use the attached code, fv!item.description and fv!item.score returns the data as a single list of string as opposed to the 10 independent dictionary items. How can I correct this?
rows: { a!forEach( items: local!gvLabels, expression: a!gridRowLayout( contents: { a!textField( value: fv!item.description ), a!textField( value: fv!item.score ) } ) ) },
Discussion posts and replies are publicly visible
Are you able to provide a sample of what the structure of local!gvLabels looks like?
try:
local!gvLabels.description[fv!item]
[mid:/m/02q2kc3,description:Vehicle door,score:0.8949996,topicality:0.8949996]; [mid:/m/07yv9,description:Vehicle,score:0.7891846,topicality:0.7891846]; [mid:/m/01lrnl,description:Windshield,score:0.7330366,topicality:0.7330366]; [mid:/m/0h8ls87,description:Automotive exterior,score:0.7311965,topicality:0.7311965]; [mid:/m/02mnkq,description:Bumper,score:0.7284476,topicality:0.7284476]; [mid:/m/039jq,description:Glass,score:0.7177184,topicality:0.7177184]; [mid:/m/0k4j,description:Car,score:0.6750773,topicality:0.6750773]; [mid:/m/0h8lhq_,description:Automotive window part,score:0.6319218,topicality:0.6319218]; [mid:/m/02df64,description:Hood,score:0.5599056,topicality:0.5599056]; [mid:/m/02417f,description:Windscreen wiper,score:0.5486392,topicality:0.5486392]
Output in a paragraph field.
Doesn't seem to do anything. Tried fv!index as well, which successfully returns the first value from the list of values making me even more confused. Apparently it understands that this is a dictionary but fails to index out the list correctly when in a!forEach.
what happens when you do fn!typename(fn!typeof(local!gvLabels)) ?
if that comes back as "Text", that could part of your problem - did you make a CDT to load these into?
That's most likely the issue. It's returning a list of variant.
Hi Justin,
Before sending the local!gvLabels in fn!foreach loop, Could you try casting the local variable to CDT type and loop?
cast( typeof( type!CDT ), local!gvLabels)
It's interesting to me that it's recognized as a dictionary but the usual functions are failing. Could you potentially try splitting the output inside the forEach, and then taking the index at that point?
so instead of fv!item.description its split(fv!item.description, ", ")[fv!index]