Weighment integration

Hi All,

I done the integration of weighment with Ax 2009. But, when using the breakpoint on the form only, i can receive the data, without using the breakpoint, i can’t receive the value. It shows empty.

The code is as listed.

_Port.Open();

for (i=1;i<=80000;i++)

{

}

// breakpoint;

While(strlen(ntstring)<=5)

{

ntstring = _Port.ReadExisting();

}

_Port.Close();

I uses the loop for delay the process. but i can’t receive, any solution. Please …

Thanks in advance.
G.Rajkumar.

You can sleep() function to create a delay (e.g. sleep(1000) to stop processing for one second).

That the result isn’t ready yet if you don’t pause your code by a breakpoint is something what makes sense. Just sleeping for a while isn’t a great solution, because you have to choose time long enough to cover all ordinary cases and your function can’t ever be faster than that, even if the result is available immediately. You can at least try to look for the result several times in shorter intervals, which reduces the minimal time needed and still leaving enough time for slower cases.

If the object supports any type notification, you should use it. (Unfortunately I have no idea what _Port is.)

By the way, although I don’t know what ReadExisting() returns, I would be concerned whether the code can’t get into an infinite loop.

Ya fine, thank you Martin,

I found the solution & its working fine. I code to read the second line of the ListIterator which contains the empty data. The data presents in the first line only. Now its working fine on both mini & Large Weighment.

Thank you once again,

G.Rajkumar.