Hi,
Is it possible to assign a string to a collection directly and that Make parse it if it’s properly formated?
Haven’t found a way/format that works.
Example:
Collection Foo
- Bar1: String
- Bar2: Number
Field1: Foo
Actually, I’ve tried every permutation of every function :'D
I’m just trying to create a Collection with two fields in this example
It should end as:
{
"Bar1":"Beer1",
"Bar2":2534
}
toCollection (very poorly documented, I spent hours trying to understand how it treated the input data), takes in input an array, each row of the array being a key-value pair representing FieldName and FieldValue for the target collection. That’s why I was trying to format my input string as { [ “Bar1”, “Beer”], [“Bar2”, “2534”]}
But It can’t transform the string into a collection it seems. toCollection( { [ “Bar1”, “Beer”], [“Bar2”, “2534”]}) fails to execute too.
What works is toCollection(add(add(),add()) but it works just for this simple example, and in my case I have an array of indefinite number of collections. As there is no iterative or recursive functions, I can’t do it directly in one field. Hence my search for a string pattern allowing to assign this string to a Collection field.
Have you tried an iterator (under tools) that sends each part of your collection and then have a set variable step that adds to the array iteratively. There’s no recursion but there is an iterator.
Yep, but I wanted to overload my scenario with lots of modules, and wanted to do that inline in one script.
I’m trying to do it right now by generating a JSON string and parsing it with the JSON parser module. It just adds 1 module. Just having formatting issues.
It’s really hard to overload Make. Easy to read and manage scenarios are broken down into multiple modules. If you are trying to design your scenario to conserve operations you may really be spending a ton of time trying to optimize for no really good reason. 1000 operations for free will be burned just testing.
Use an iterator after Parse Json or just get the raw array data and eliminate the use of json.