Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to add a table to data environment in code?
Message
From
29/10/1998 11:22:12
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00151065
Message ID:
00152367
Views:
24
>>>Long story - But the Fields listbox of the Expression Builder of the Report Expression window (wow!), will only show fields of tables in the data environment. I have a temp table that i want added to the data environment so that its fields will show in the Fields List Box.
>>>
>>>any ideas?
>>>
>>>thanks - brenda
>
>>With thisform.dataenvironment && It has one already ? If not createobject(DE)
> .addobject("myTempCursor","cursor")
> .myTempCursor.CursorSource = dbf("crsTemp") && crsTemp is temp cursor
>endwith
>
>>Cetin
>
>I want to add a cursor (maybe a table built from the cursor fields) to the dataenvironment of a report, not a form. Tried getting your code to work but had no luck.
>
>in the command window
>
>select * from testtable into cursor mycursor
>create report myreport from mycursor column
>modi report myreport
>
>** now the report designer is up. is there automatically a dataenvironment associated with myreport? or must i add one? if i have to add one, what is the code?
>
>report5.dataenvironment.addobject("tempcursor", "cursor")
>** "object report5 not found" is the error message
>
>really lost on this one. any help is appreicated.
Brenda,
You can add it automatically if you select into a temp table and later erase it. But it has the problem user also adds alias to new fields. Next time you would need to process frx programmatically to remove aliases. Yet there is another better way but fields show in memvar list (advantage you use unaliased expressions) :
select * from ;
	home()+"samples\data\customer" ;
	where Contact = trim(thisform.text1.value) ;
	nofilter ;
	into cursor (lcCrs)
*create report myreport from alias() column
scatter memvar blank
modify report myreport
report form myreport preview
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