Forum

Node reduces SpreadCount, how to retain Input SpreadCount and order?

Ahoi vvvvolks

Amidst my parsing adventures I need to solve the following issue:
When not all Slices in a Spread return a match using GetElements (XML ByPath) and Element (XML Split), I end up with a SpreadCount less than the Input Spread.
https://vvvv.org/sites/default/files/imagecache/large/images/Get%20Labels_2013.03.01-15.30.43.png White Nodes are irrelevant here.

I need an Output Spread with the same SpreadCount as the Input Spread, the formerly missing slices shall be of an arbitrary value (ie. 1), retaining the original order.
Try as I might, I can’t get my head wrapped around this, although I suspect the answer to possibly be trivial.

Please find attached a non-functional patch, illustrating my issue.

  • Patrick

Missing Slices.v4p (7.1 kB)

maybe KeySort (Spreads) can help?

Thx tf, that’s a useful hint for another thing that needs to be resolved, but it won’t do in this case. I need a solution to inject slices into the Output Spread, containing an arbitrary value, in the slice positions that are left out, thus retaining the order and SpreadCount of the Input Spread.

Still don’t get why you want that :). But see attached patch for how to achieve it.

What should happen if some XPath queries return more than 1 element? How should the output spread look like (out of the blue I would say there is no meaningful solution for that).

Patrick_helppatch.v4p (7.5 kB)

Thanks herbst, that’s it!

This subpatch queries all releases of an Artist on discogs.com, on behalf of discogs there’s a limit of 100 releases per page.
Querying for “pages” evaluates the amount of pages (ie. 6) per Artist, so we know how to build the subsequent get request, which returns all relevant pages (ie. 1-6) for an Artist—when all releases fit on one page, querying for “pages” returns just a mismatch. When it’s just one page, the secondary get request must employ a different string for the “get all Artist’s releases” request, or else there’s errors abound.
Thus, left out answers (missing slices) impose problems I had to solve.

Ah, okay - so you’re leaving the comfortable world of spreads there. I was just curious.

I wouldn’t subscribe to that point of view though, as I see spreads in abundance in these patches (some of them yet to make more sense). But, if you don’t mind, I’d be glad to share my thoughts with you in real time via Skype or IRC (meso/vvvv) :] …