Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CommaIo object not initialized. Help please.

1,396 views
Skip to first unread message

ACO

unread,
May 31, 2007, 11:43:00 AM5/31/07
to
I have done this many times but for some reason this new class is giving me:

Error executing code: CommaIo object not initialized.

Straightforward stuff...

inputFile = new CommaIo(_fileName, #io_read);
info(strFmt('Status: %1', inputFile.status()));


The code blows up on the info() statement.

inputFile is defined in classDeclaration as type CommaIo.

_fileName is defined as a string.

_fileName does contain a correct, fully-qualified file name.

It doesn't matter where the file is located.

It is a text file.

There are not access security issues.

It does conform to CSV layouts.

Why?

Peter Laursen

unread,
May 31, 2007, 3:32:46 PM5/31/07
to
"ACO" <A...@discussions.microsoft.com> skrev i en meddelelse
news:E172A399-8FFA-4B36...@microsoft.com...

>I have done this many times but for some reason this new class is giving
>me:
>
> Error executing code: CommaIo object not initialized.
>
> Straightforward stuff...
>
> inputFile = new CommaIo(_fileName, #io_read);
> info(strFmt('Status: %1', inputFile.status()));
>
>
> The code blows up on the info() statement.

Havnt got an AX here but isnt CommaIO abstract? Try using AsciiIO.


Mathias

unread,
May 31, 2007, 3:54:00 PM5/31/07
to
Hi ACO,

i am pretty sure the file causes this error.

you need to use doublebackslash in order to get a backslash in your string

ie.
doesnt work
str _filename = "c:\mytext.txt";

works fine
str _filename = "c:\\mytext.txt";

i suggest you take a deep look at _filename.

Regards

--
Mathias Füßler
my blog: http://starside.eu

ACO

unread,
May 31, 2007, 4:01:00 PM5/31/07
to

"Peter Laursen" wrote:

AsciiIo also blows up. I've been using CommaIo all along and have plenty of
other class modules using CommaIo just fine. I have looked at working classes
comparing methods back and forth but cannot find anything being done in a
non-standard way. I suspect this is one of those minor gotcha's having to do
with the stack or something along those lines. (I have already tried moving
objects around in classDeclaration just to see if it matters.)

FWIW, this is AX 3.0 SP 3.

ACO

unread,
May 31, 2007, 4:25:00 PM5/31/07
to

"Mathias" wrote:

> Hi ACO,
>
> i am pretty sure the file causes this error.
>
> you need to use doublebackslash in order to get a backslash in your string
>
> ie.
> doesnt work
> str _filename = "c:\mytext.txt";
>
> works fine
> str _filename = "c:\\mytext.txt";
>
> i suggest you take a deep look at _filename.

Thanks. I am very aware of the requirement for escaped backslashes in
strings. Whether I hardcode the qualified file name (as in your second
illustration) or obtain it through a dialog (using
dialog.addField(typeId(FileNameOpen), "File name")) I get the same results.

ACO

unread,
Jun 1, 2007, 9:45:00 AM6/1/07
to
Mathis:

Here's one for your blog.

"CommaIo object not initialized" was indeed file-related but in a more broad
sense.

The code was correct. The file path and name were correct. Backslashes were
escaped. The calls, the setup, everything was correct, except...

When a new Class is created the RunOn property is set to "Called from" by
default. Changing that to "Client" fixes the problem.

</sigh>

Thought everybody would like to know.

L@discussions.microsoft.com Michael L

unread,
Jul 30, 2010, 8:07:03 AM7/30/10
to
ACO,

I have been searching for this for about 2 days!
Thanks a million!
This did the trick......

0 new messages