LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Updating controls in a cluster programmatically (or update cluster controls from arrays of labels and values)

Hi altenbach, 

 

(just noticed I had your handle incorrect, apologies).

 

that video is really hard to look at, are the slides posted somewhere?

0 Kudos
Message 11 of 19
(548 Views)

We can't tell you why you have a problem since you didn't post your code. And being salty at the people trying to help you for free isn't going to win you a lot of support.

 

You seem to be missing the point of the Maps. Maps will let you greatly speed up your searching, and you can still use the cluster if you want. You'd just store the reference to each internal control as the Value in the map, using its label as they key. You can probably do away with the cluster entirely by just iterating over the entire cluster, creating the map in one go. The key would then be the cluster element name, the value is the value you want to store.

 

Either way I get that you don't want to replace that, you just want to know what's going on with your code, but you haven't posted code so we don't know why it's not working. You just posted a partial image; we cannot debug images.

0 Kudos
Message 12 of 19
(548 Views)

Just a suggestion, but if I had your use case I would go direct from JSON to the PDF form, skipping any intermediate representation.  I would use the JSONtext library.

0 Kudos
Message 13 of 19
(548 Views)

@xfrmrs wrote:

 

that video is really hard to look at, are the slides posted somewhere?


(I meant that Maps are better than variant attributes and both are way superior to whatever you were doing 😄 )

 

A link to the slides is right under the video. (Yes, I agree that the recording is not that great.)

 

0 Kudos
Message 14 of 19
(532 Views)

HI altenbach, 

 

there may still be a misunderstanding, 

 

suffice to say that i am not using the variant attribute _instead of_ using a map, but what i am doing gets super complicated to write up in any worthwhile detail, though i'll make a go of it ...

 

QA requires that the fields generated by the application be matched to the fields extracted from the PDFs prior to pushing the data into the PDF.  hence the need to match the labels (or keys) from the PDFs with the generated labels (or keys),

 

each report has a distinct type def which is programmatically created based on the fields in the PDFs, these are compared the labels generated by the application to satisfy the QA requirement (of ensuring the data is placed in the right places in the PDFs).

 

it's the QA part which requires matching up the labels from the PDF with the labels generated by the application.  without that, i could simply generate the map and push that into ... the PDFs.. 

0 Kudos
Message 15 of 19
(527 Views)

hi drjdpowell, 

 

i'll look into the JSONtext lib.  thanks for the suggestion.

 
0 Kudos
Message 16 of 19
(522 Views)

Hi BertMcMahan, 

 

it's not that i want to keep the clusters, nor that i don't grok the map, nor that i just want to know what broken in my code.  it's that the tool to automate the extraction of the PDF fields generates the clusters.  there may be better tools for that part, which is why i asked the bigger picture question.

 

the point is to match the field names generated by the application to the field names in the PDFs, not searching the values.

 

as i mentioned this morning, i found the issue in the code this morning.  your (and altenbach's) point about the partial code, is well taken, though perhaps not well delivered...

 

as for being salty, well, i suppose we could do with less of that.

0 Kudos
Message 17 of 19
(517 Views)

HI folks, 

 

(update)

 

just to see how clean using maps made the construction, I recreated the data structure containing the labels and values using maps rather than using property nodes to facilitate matching the labels in the pre-existing clusters and stuffing the values.. 

 

as noted before, the populated data structure is then pushed out as a JSON string.

 

only to find out that the built-in "Flatten to JSON" polymorphic function does not work with maps.

 

thanks for all the discussion.

 

    

0 Kudos
Message 18 of 19
(507 Views)

You can still use the clusters- just create your map using key/value of cluster label/element reference. Then, instead of searching through ALL of the labels for EVERY value, just index the map by your value name. Now you have a reference and can write to the property node. Now you search the whole names array once instead of every single time.

0 Kudos
Message 19 of 19
(503 Views)