Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting value from a table opened in a different DS
Message
From
11/03/2010 13:53:28
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01453599
Message ID:
01453987
Views:
60
This message has been marked as a message which has helped to the initial question of the thread.
>>>>>>>I meant - I don't want to change code in the main application object class. I don't know what implications may arise if I change it. I wanted to only change the form's code assuming the application object is a black box.
>>>>>>
>>>>>>That is what I don't understand. Why would getting items say into an array would cause a change in application object class. You would do that from within your form.
>>>>>>Cetin
>>>>>
>>>>>How can I get them into the array without changing code of the application object class? The method that produces the cursor I wanted to access is in application object and I didn't want to touch its code.
>>>>
>>>>You have already opted to make the change in your other reply where you liked the idea of attaching an object there.
>>>>Cetin
>>>
>>>Attaching the extra object in run-time doesn't make a change in the class code, so IMHO, it's a big difference here.
>>
>>We have a seious communication problem:) OK how you prefer. You would get the array even w/o attaching something:)
>>Cetin
>
>Consider this
>
>define class AppObject
>
>procedure MakeCursor
>  create cursor curTest (SomeField C(10))
>  insert into curTest values ('Test')
> endproc
>   
>enddefine
>
>main program of the application
>
>public oAppObj
>
>oAppObj = createobject('AppObject')
>
>
>---------------------------------------------
>form's code (form with private DS)
>
>oAppObj.MakeCursor()
>
>Now I need to get value of the curTest.SomeField. I can not change MakeCursor method in any way.

And you don't need to!
Set DataSession To oAppObj.DataSessionId
Select MyTable
loRetData = Createobject('Empty')
AddProperty( loRetData, 'records', Reccount() )
If Reccount() > 0
  AddProperty( loRetData, Textmerge( 'Row[<< reccount() >>]' ))
  Scan
    Scatter Name loRetData.Row[recno()]
  Endscan
Endif
set datasession to this.DataSessionID
messagebox( loRetData.Row[1].SomeField )
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform