searchFromEnd:True in index unexpected in arguement

searchFromEnd:True in index unexpected in arguement

  

Editor doesn;t like me putting the searchFromEnd or startIndex into an Index search, it always complains "Unexpected arguement named 'SearchfromEnd' in function 'Index' call.


Does anyone have any advise?

Cheers

Hamish


SyntaxEditor Code Snippet

MimeTypes.FileExtension = Substr(TempFile.FileName,Length(TempFile.FileName) - Index(TempFile.FileName, ".",searchFromEnd:True), Length(TempFile.FileName))

Hi,


tbh, dunno, when i do it the expression is ok, so not sure what is different.

Can you share the specific part in a simple oml ?


Here you go. I was trying to use the code snippet above in the filter of the GetMimeTypesByFileExtension aggregate. What I attach I have changed the 3rd filter to the following so I can publish it, however this assumes there is only one "." in the filename, which isn;t always true.

SyntaxEditor Code Snippet

MimeTypes.FileExtension = Substr(TempFile.FileName,Index(TempFile.FileName,"."),Length(TempFile.FileName))

Cheers

Hamish

Solution

You don't have to publish it to download the oml.

So if you can, can you export the faulty oml (Menu -> Export -> Save As)


nvm, you want to do it in an aggregate, that explains it.

use a local variable instead, there you do the assign for extension and resilve it the way you want, then you pass that local var to the aggregate.


I did encounter this issue before and was a bit surprised as well :)

not sure if it's a bug or by design, will ask around

Solution

Thanks.

That worked. As you say, feels a little buggy, however using a variable to load the statement in to the filter works.

Hamish

Not sure why it "feels" buggy, but it is slightly strange yes :)

good luck with the project!