Variables in Mongoose

Hi,

is possible to declare more complex variables in Mongoose Form Designer?

Now I am able to declare only simple String variable. Is possible to declare for example List<String> or something more complex like List<MyClass>?

My interest is in passing more complex structures like List<MyClass> between forms. Is that possible?

Thanks.

  • You should be able to read Objects (Data) of your Parent Form if necessary, This is probably better than sending Variables regardless.

  • Please do you have any example for this? How can I read data in child form from parent form?

    EDIT

    Ok, I think I can see it now. It's ThisForm.ParentForm syntax.

    But by this I can get only to objects declared in Form Designer?

    Is there any possibility how to get to the objects declared in my Parent form FormScript?

  • You should just be able to use the Set Variables on the run form event to set variables on the child form.

  • Although I agree using ThisForm.ParentForm when possible and/or passing variables in using the run form event handler is the best practice, if you really need to pass something more complex you can accomplish it by serializing your CLR objects to a base64 string and assigning the value to a form variable. This variable can then be used to pass the data structure into another form or global script code or even IDO methods. If calling global script or IDO method, you don't necessarily need to assign the value to a form variable. In the receiving code, deserialize the base64 string into its corresponding CLR type. If using IDO methods, you can pass this string as a ref parameter as well.

    However, I must caution that passing too much data in this way can cause a performance hit. I have no hard numbers on where that limit would be but if your resulting base64 string is over a few KB, I would probably avoid doing this.... ymmv.

    I have done this successfully with simple List<string> and Dictionary<string,List<string>> objects. I would recommend keeping any classes small and simple to reduce their serialized size.

    The better question to ask may be, why do you need to do this in the first place? If you have common code between two forms, create a global script or IDO method instead so that both forms can use the same code. If its simply a case of passing common data, then providing that data in all forms through an IDO collection would be best. If its a case of the receiving form needing additional values in the data created in another form you could accomplish this by adding properties to an existing IDO or using a "companion" IDO to provide the additional data, or by passing simple variable values between forms.

    I would suggest considering serializing CLR objects as a last ditch effort... but if you need to, you can.