C3 Data Convert Example

2
  • 0 favourites

Index

Stats

1,130 visits, 2,577 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Transpose Array

There is an array

Name	Cost	Price
Apple	12		3
Bass	24		6
Carrot	32		8

transpose Array

Name	Apple	Bass	Carrot
Cost	12		24		32
Price	3		6		8

Function:

Need a Temp Array Object

Direct Transpose

clipboard (need 2 Array Object: Array and Temp)

{"is-c3-clipboard-data":true,"type":"events","items":[{"functionName":"TransposeArray","functionDescription":"","functionCategory":"","functionReturnType":"none","functionCopyPicked":false,"functionIsAsync":false,"functionParameters":[],"eventType":"function-block","conditions":[],"actions":[{"id":"load","objectClass":"Temp","parameters":{"json":"Array.AsJSON"}},{"id":"clear","objectClass":"Array","parameters":{"value":"0"}},{"id":"set-size","objectClass":"Array","parameters":{"width":"temp.Height","height":"temp.Width","depth":"temp.Depth"}}],"children":[{"eventType":"block","conditions":[{"id":"for","objectClass":"System","parameters":{"name":"\"X\"","start-index":"0","end-index":"temp.Width-1"}}],"actions":[],"children":[{"eventType":"block","conditions":[{"id":"for","objectClass":"System","parameters":{"name":"\"Y\"","start-index":"0","end-index":"temp.Height-1"}}],"actions":[{"id":"set-at-xy","objectClass":"Array","parameters":{"x":"loopindex(\"Y\")","y":"loopindex(\"X\")","value":"temp.At(loopindex(\"X\"), loopindex(\"Y\"))"}}]}]}]}]}

Dynamic Transpose

Skip Empty Rows/column

{"is-c3-clipboard-data":true,"type":"events","items":[{"functionName":"TransposeArray","functionDescription":"","functionCategory":"","functionReturnType":"none","functionCopyPicked":false,"functionIsAsync":false,"functionParameters":[],"eventType":"function-block","conditions":[],"actions":[{"id":"load","objectClass":"Temp","parameters":{"json":"Array.AsJSON"}},{"id":"set-size","objectClass":"Array","parameters":{"width":"0","height":"1","depth":"1"}}],"children":[{"eventType":"block","conditions":[{"id":"for","objectClass":"System","parameters":{"name":"\"Y\"","start-index":"0","end-index":"temp.Height-1"}},{"id":"compare-two-values","objectClass":"System","parameters":{"first-value":"Temp.At(0, loopindex)","comparison":1,"second-value":"\"\""}}],"actions":[{"id":"push","objectClass":"Array","parameters":{"where":"back","value":"loopindex","axis":"x"}},{"id":"set-at-xy","objectClass":"Array","parameters":{"x":"loopindex","y":"0","value":"temp.At(0, loopindex)"}}]},{"eventType":"block","conditions":[{"id":"for","objectClass":"System","parameters":{"name":"\"X\"","start-index":"1","end-index":"temp.Width-1"}},{"id":"compare-two-values","objectClass":"System","parameters":{"first-value":"Temp.At(loopindex)","comparison":1,"second-value":"\"\""}}],"actions":[{"id":"push","objectClass":"Array","parameters":{"where":"back","value":"0","axis":"y"}}],"children":[{"eventType":"block","conditions":[{"id":"for","objectClass":"System","parameters":{"name":"\"Y\"","start-index":"0","end-index":"temp.Height-1"}},{"id":"compare-two-values","objectClass":"System","parameters":{"first-value":"Temp.At(0, loopindex)","comparison":1,"second-value":"\"\""}}],"actions":[{"id":"set-at-xy","objectClass":"Array","parameters":{"x":"loopindex(\"Y\")","y":"loopindex(\"X\")","value":"temp.At(loopindex(\"X\"), loopindex(\"Y\"))"}}]}]}]}]}
  • 0 Comments

  • Order by
Want to leave a comment? Login or Register an account!