Recursive function call in codeless?

Hi all,

is it possible to call a function in codeless in itself? So call it recursive? I wand to process objects in objects in objects…

I tried to test this, but when I call my function inside the function, the execution breaks up, due to a longer processing time than 5s. Also when I do nothing and return immediately the second time when the function is called.

Best regards

Hi Jonas

Yes, it’s possible

Could you provide your App ID, or provide screenshot of your logic, it help me to investigate why it does not work

Regards, Vlad

Hi Vladimir,

the AppID is: 63087FF7-7E1D-973D-FF3B-D5F0740FA100. The function name is: FilterObjectProperties.
Thanks for having a look.

I’ve looked at your logic and find nothing that should not works.
may be the problem is with input parameters.

could you provide the input parameters, it may be no real data but should have the same data model as a real data. for ex: [{a:‘a’, b:‘b’, c:{ d: ‘d’ } }] and props => [‘a’, ‘b’, { … } ]

and also what you would like to have as result.

My data/objects in the array (parameter “Object”) looks like below. They come directly out of the Load table objects block.
After the FilterObjectProperties function I want some properties of the objects in the array and the subobjects (User) to be removed.

[
        {
            "a":"sss",
            "b":"sss",
            "User":
            {
                "ID":"sss",
                "created":nnn,
                "name":"sss",
                "ownerId":"sss",
                "updated":nnn,
                "objectId":"sss",
                "email":"sss",
            },
            "c":nnn,
            "d":nnn,
            "e":nnn,
            "f":"sss",
        },
        {
            ....
        },
        ....
]
Properties:
[
    'a',
    'b',
    'c',
    {
        "Name": "User",
        "Items": [
             'ID',
             'name'
        ]
    }
]

currently your function “FilterObjectProperties” returns a list, is it ok?

because if you want just remove some fields the function should not transform Object to List, but it’s not a problem

I’ve run the code locally and everything works




const sourceList = [
  {
    "a"   : "sss",
    "b"   : "sss",
    "User": {
      "ID"      : "sss",
      "created" : 11,
      "name"    : "sss",
      "ownerId" : "sss",
      "updated" : 22,
      "objectId": "sss",
      "email"   : "sss",
    },
    "c"   : 11,
    "d"   : 222,
    "e"   : 333,
    "f"   : "sss",
  },
  {
    "a"   : "sss",
    "b"   : "sss",
    "User": {
      "ID"      : "sss",
      "created" : 11,
      "name"    : "sss",
      "ownerId" : "sss",
      "updated" : 22,
      "objectId": "sss",
      "email"   : "sss",
    },
    "c"   : 11,
    "d"   : 222,
    "e"   : 333,
    "f"   : "sss",
  }
]


const props = ['a', 'b', 'c', { "Name": "User", "Items": ['ID', 'name'] }]


console.log('FilterObjectProperties result', FilterObjectProperties(sourceList, props))
 

result:

[
{"a":"sss","b":"sss","c":11,"User":[ {"ID":"sss","name":"sss"} ]},
{"a":"sss","b":"sss","c":11,"User":[ {"ID":"sss","name":"sss"} ]}
]

could you create a test service/method and put here only one function “FilterObjectProperties”?

and call the service/method with parameters what you have, and we can see if the problem is with this function or with something else