Rocket Software Homepage
Forum Home Forum Home > AccuTerm Knowledge Base (read only) > Advanced Features
  New Posts New Posts RSS Feed - ObjectBridge
  FAQ FAQ  Forum Search   Register Register  Login Login

The AccuTerm forum has moved. Go to community.rocketsoftware.com to register for the new Rocket forum.

Forum LockedObjectBridge

 Post Reply Post Reply
Author
Message
warossi View Drop Down
Newbie
Newbie


Joined: February 11 2008
Location: United States
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote warossi Quote  Post ReplyReply Direct Link To This Post Topic: ObjectBridge
    Posted: September 29 2011 at 1:25am
I am trying to get data from an excel spreadsheet using objectbridge.  I took the example and modified the
      CALL ATGETPROPERTY(Worksheet, Z1, Z2, ERRMSG, OPTS)
to
      CALL ATSETPROPERTY(Worksheet, Z1, Z2, ERRMSG, OPTS)

assuming that Z2 would contain the values of the cells specified in Z1.  This is not the case.  it is coming back with something but not the data in the cell.  I am using this to find a specific value to use as a starting point for other modifications.

Thanks
Bill Rossi

warossi@direct-path.net
Back to Top
PSchellenbach View Drop Down
Admin Group
Admin Group

Moderator

Joined: December 15 2003
Location: United States
Status: Offline
Points: 2150
Post Options Post Options   Thanks (0) Thanks(0)   Quote PSchellenbach Quote  Post ReplyReply Direct Link To This Post Posted: September 29 2011 at 4:31am
Hi Bill -

If you examine the sample UPDATE.EXCEL.SPREADSHEET program, you see that Z1 and Z2 are dynamic arrays passed to ATSETPROPERTY. Z1 is a list of property names and Z2 is a corresponding list of values to assign to those properties. The property name in Z1 can be appended with index values if the property acts like an array. In the example, the property name is 'Cells', which in Excel, works like an array, so the row and columns are appended using SVM as a separator. In the case of ATGETPROPERTY, Z1 is exactly the same as ATSETPROPERTY, and Z2 should return the cell values.

Thanks,

Pete
Back to Top
warossi View Drop Down
Newbie
Newbie


Joined: February 11 2008
Location: United States
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote warossi Quote  Post ReplyReply Direct Link To This Post Posted: September 29 2011 at 11:42pm
Pete,

That's what I thought but the results don't agree.

I added this code to the UPDATE.SXCEL.SPREADSHEET program


      CALL ATSETPROPERTY(Worksheet, Z1, Z2, ERRMSG, OPTS)
      IF ERRMSG NE '' THEN PRINT ERRMSG; CALL ATRESETOBJMGR; STOP
      
      Z3=''
      CALL ATGETPROPERTY(Worksheet, Z1, Z3, ERRMSG, OPTS)
      IF ERRMSG NE '' THEN PRINT ERRMSG; CALL ATRESETOBJMGR; STOP      
      CRT Z3
and the output of Z3 looks line this

15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34

Seperated by @AM when I expected to get the data I passed.

Thanks
Bill Rossi

warossi@direct-path.net
Back to Top
PSchellenbach View Drop Down
Admin Group
Admin Group

Moderator

Joined: December 15 2003
Location: United States
Status: Offline
Points: 2150
Post Options Post Options   Thanks (0) Thanks(0)   Quote PSchellenbach Quote  Post ReplyReply Direct Link To This Post Posted: September 30 2011 at 11:14am
Hi Bill -

It looks like the Cell(x,y) property returned by Excel is not a string, but a Range object. ObjectBridge represents objects using consecutive integers, which explains what you are seeing. You need to then use each of the values returned in Z3 as objects and call ATGETPROPERTY for each of these, retrieving the 'Value' property of each:
Z3=''

CALL ATGETPROPERTY(Worksheet, Z1, Z3, ERRMSG, OPTS)
FOR I=1 TO DCOUNT(Z3,AM)
CALL ATGETPROPERTY(Z3<I>,'VALUE',Z4,ERRMSG,OPTS)
PRINT I:' ':Z4
NEXT I

Sorry about the misinformation. Excel's object model is quite complex, and ObjectBridge sometimes is too simplistic to cope adequately.

The reason it worked to set the property is that Excel probably uses the Value as the default property for the Range object, so it was not necessary to explicitly set it.

Thanks,

Pete
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.03
Copyright ©2001-2019 Web Wiz Ltd.