Book a Demo

Author Topic: Really simple one: operation array parameters  (Read 2327 times)

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Really simple one: operation array parameters
« on: May 06, 2009, 09:48:36 pm »
Hey everybody,


I'm almost embarrassed to ask, but admitting that you have a problem is the first step and all that.

Specifying that an operation parameter is an array: how?

Operation return values may be specified as as arrays by ticking the box in the operation details dialog. But there's no similar one in the parameter detail dialog.

If I manually add [] to the end of the parameter type name, EA doesn't warn me that the parameter fails to parse, which it does if I add, say, just the [.

So is this the correct way of doing it, or is there another correcter way?

Cheers,


/Uffe
My theories are always correct, just apply them to the right reality.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Really simple one: operation array parameters
« Reply #1 on: May 07, 2009, 07:19:12 am »
Hi Uffe,

That's a really good question. AFAIK there is no way to do this 'directly' within the containing class. It seems you can directly specify a collection for an attribute, but not for an operation parameter.

If EA allows both brackets but complains when you add one bracket (or otherwise provide illegal syntax), then I think you are OK. At least this will work for arrays of simple types. Have you tried this with a source code language that uses different syntax? Perhaps VB.Net instead of C(something) so that you'd need parentheses instead of square brackets. If you do this and get a complaint about the wrong syntax (when you use the wrong bracket type) you may have your answer.

For collections things could get more difficult. My best guess--this certainly works, but I am not certain whether it was the (only) way that Sparx intended--is to create a class (or other datatype artifact) to represent your collection. Then reference that entity using the '...' button on the dialog. This is a bit more convoluted than with parameters, but in a well defined model should not add significant (or perhaps any) complexity to the overall model.

Can anyone else shed some light on this?

David
No, you can't have it!