lakoon
29th July 2003, 20:47
I'm setting up a test example to read item data from baan into an access DB.

For this reasons I have created the necessary elements in the OW Designer. (ROWTyps, CONNECTORS, ITERATORS).

In the Connector Login script I have entered the following lines:

Login Script:
==========================================
{
OleObject ItemBOI;

try
{
System.debug ("COMPONENT_Item Login");

//DLL = Items, Klasse = ItemsManager

ItemBOI = OleObject("Items.ItemsManager");

ItemBOI.initialize("cn=BaanTest, o=ced");
this.BOI = ItemBOI;
}
catch (Exception e)
{
String mess;
mess.sprintf("%d %s %s", e.code, e.reason, e.description);
System.debug(mess);
}
}
==========================================

In the ITERATOR I have entered two scripts. One in the Initialization section and the other one in the Iteration Section

Initialization script:
==========================================
{
String errormessage;

try
{
System.debug("ITERATOR_Item - Initphase");
this.BOIPointer = Session.BOI.Show("LEI1080");
System.debug(String(Session.BOI.getCurrentBackend()));
}
catch(Exception e)
{
errormessage.sprintf("%d|%s|%s", e.code, e.reason, e.description);
}

}
==========================================

Iteration script:
==========================================
Script Iteration
{
OleObject ItemObj;
String errormessage;

try
{
System.debug("ITERATOR - Loop");
ItemObj = OleObject("Items.Items");
System.debug("1");
ItemObj = this.BOIPointer.nextElement; <<==???
System.debug("2");
System.debug(String(ItemObj.getItem()));
System.debug("3");
return 0;
}
catch (Exception e)
{
errormessage.sprintf("%d|%s|%s",e.code,e.reason,e.description);
}
}
==========================================


The Iteration script does not work from the marked point on (<<==??).
How can I transfer the pointer to the ItemObj?
How do I have to ask for the next Elements (number of).

Actually I woul like to do something like that:
=========================
if(Number(this.BOIPointer.hasMoreElements()))
{
ItemObj = this.BOIPointer.nextElement;
Result.Item = String(ItemObj.getItem());
Result.Description = String(ItemObj.getDescription());
return 1;
}
else
{
return 0;
}
====================

Any help would really make me happy....

thanks...

lakoon
30th July 2003, 11:49
maybe somebody has a broker script example where I could see
the way you do it.

script from the ITERATOR Element Event Initialization and Iteration

thanks ...

lakoon
31st July 2003, 10:54
Hello

After going through my scripts (serveral times) I've finally got it working.

The scripts loads item data from baan into an access db.

For those who are intersted, I have attached all the scripts in a File.

... to the next Time

bemisgrm
6th August 2003, 23:02
Could you provide the example also as a broker designer export file? (ora file)

lakoon
8th August 2003, 13:36
Hello bemisgrm

as soon i get back to the system, i will create the dump and place it here.

bye...