SQLExpress - Xb2.NET     ot4xb  
   Announcement      Free XUG Meeting Toronto/Canada (May 25, 2008)       [ More Info ... ]
sqlexpress
Ghost Record
Thread Starter: Osvaldo Ramirez Started: 4/3/2008 4:32 PM UTC
Replies: 8
Ghost Record
Hi, guys

In the DBF concept, I can go to ghost record using gobottom+skip, so I accept new record, but How Can I do using SQL commands ?

thanks in advance

Osvaldo Ramirez
Re: Ghost Record
Hello Osvaldo,

In the DBF concept, I can go to ghost record using gobottom+skip, so I
accept new record, but How Can I do using SQL commands ?

Rethink your use of the 'ghost' row.  SQL is not going to return any rows that are not in the actual table.

If you describe the use, I am sure we can come up with alternatives.

Regards,

Rodd Graham, Consultant
Graham Automation Systems, LLC
Re: Ghost Record
Dear Rodd

I am starting a new First-Complete-In-SQL-project, so I want to re-think all.

Because the use of the browse, as first window to make all kind of DBF operation, isnt good, I need begin with a Form, showing all fields with buttons, like, "add","edit","find","Order",etc,etc.
( Please see my current dbf browse picture )

So, If I press "add", i need to fill up my fields with spaces.
If I press "edit", i need enable all fields.
( off course I need hide all buttons and show only two, save and abort )

So, that is why I asked about the ghost record.

Actually I have a PRIVATE vars for each field, when I press the "edit" button, I pass the field value to the PRIVATE var, and if press the "add" button I only init the var with spaces.

But I think theres is other way to do that.

Thanks for your help
Osvaldo Ramirez

This message includes the following attachments:

Re: Ghost Record
Hello Osvaldo,

But I think theres is other way to do that.

SQL NULLs and default values can make additional UI complications if you use them.  Ideally UI controls might support nil values (which might equate to SQL NULL) and use the control properties (picture format, etc.) to determine presentation.  Of course you still would need to compute the control properties from the underlying data schema.

Regards,

Rodd Graham, Consultant
Graham Automation Systems, LLC
Re: Ghost Record
Thanks Rodd Graham

Tell me, how do you do that ? , I mean Do you have app's with same way that I asked ?

Best Regards
Osvaldo Ramirez


 wrote:
Hello Osvaldo,
But I think theres is other way to do that.
SQL NULLs and default values can make additional UI complications if you use them.  Ideally UI controls might support nil values (which might equate to SQL NULL) and use the control properties (picture format, etc.) to determine presentation.  Of course you still would need to compute the control properties from the underlying data schema.
Regards,
Rodd Graham, Consultant
Graham Automation Systems, LLC
Re: Ghost Record
Hello news.xb2.net,

Tell me, how do you do that ? , I mean Do you have app's with same way
that I asked ?

I used to use the 'ghost' to init buffer vars, but have since implemented an automatic Object Relational Mapper (ORM) layer that lets me work with Classes instead of the database.  The ORM uses the database schema to dynamically create persistent entity classes that automatically reflect the database.  The ORM layer presents a NULL value to the UI very similar to dbSetNullValue().

I use ADS so that I can use 'workarea' style primary key seeks/recno updates/explicit row locking and SQL set based SELECTions and UPDATEs simultaneously.  I track changes at the column level and detect edit collisions so that first write wins.  I also support delta columns for numeric accumulation without collision.  I allow multiple in-memory replica instances of a single entity and do not attempt to synchronize.  For performance reasons, I use SQL cursors for browses since the ORM adds significant processing overhead and Xbase++ is not all that fast when many layers are involved.

More importantly, I standardized my UI on one 'FRAMESET' type layout with a handful of page types.  The most common pages are menu, browse, (tabbed) edit, and crystal report.  I don't attempt to use the browse for row editing since business apps tend to focus on a specific entity for editing.

My UI's are plain and simple so that I can focus the development resources on the processing model.  I hope to someday allow the simplistic UI to serve both a WinApp and WebApp from a single source code.  For now I focus on WinApps/WebServices and let HTML developers create WebApps against the Xbase++ process engine as desired.

In your example, my UI might allow the user to select an insert action while viewing a browse set which would instance a new entity class with membership in the set and open a edit page on it.  Once saved or cancelled, I would return to the browse.  

Note that I try to stay within a single, fixed size, stationary (the user can move it, I don't) window for each user focus, but allow the user to popup a new window on page transitions when desired.  Each window is treated as an independent user focus.  I also try to avoid requiring mouse operations.  The application is complete when all user focuses are closed and any background operations are finished/cancelled.

Because of the standardized UI, I have not needed the browse to present an empty row for insertion.  If I did need an empty row, I would probably INSERT it in a transaction, refresh the browse, and commit on save/rollback on cancel.  
 

ADS has a nice feature called AOF's which can implement dynamic rowsets pretty efficiently.  If I was less invested in ADS, I would use SqlExpress to access Sql Server as my primary DBE.

Hope something here helps,

Rodd Graham, Consultant
Graham Automation Systems, LLC
Re: Ghost Record
Osvaldo Ramirez <ramirezosvaldo@yahoo.com> wrote in news:12fa5eab$760aa14d
$cc8f@news.xbwin.com:

In the DBF concept, I can go to ghost record using gobottom+skip, so I accept new record, but How Can I do using SQL commands ?

if you just want to get default values for the various field data types, then you can use this:

xDefValue := oCursor:GetSQLColumn(i):DefValue

You can then use this to populate a blank row in a browser or a new form in a dialog box.

Best regards,
Boris Borzic
-- news://news.Xb2.NET
http://www.Xb2.NET
http://www.SQLExpress.net
industrial strength Xbase++ development tools
Re: Ghost Record
Thanks a lot for your info Rodd

Best Regards
Osvaldo Ramirez

Hello news.xb2.net,
Tell me, how do you do that ? , I mean Do you have app's with same way
> that I asked ?
I used to use the 'ghost' to init buffer vars, but have since implemented an automatic Object Relational Mapper (ORM) layer that lets me work with Classes instead of the database.  The ORM uses the database schema to dynamically create persistent entity classes that automatically reflect the database. The ORM layer presents a NULL value to the UI very similar to dbSetNullValue().
I use ADS so that I can use 'workarea' style primary key seeks/recno updates/explicit row locking and SQL set based SELECTions and UPDATEs simultaneously.  I track changes at the column level and detect edit collisions so that first write wins.  I also support delta columns for numeric accumulation without collision. I allow multiple in-memory replica instances of a single entity and do not attempt to synchronize. For performance reasons, I use SQL cursors for browses since the ORM adds significant processing overhead and Xbase++ is not all that fast when many layers are involved.
More importantly, I standardized my UI on one 'FRAMESET' type layout with a handful of page types.  The most common pages are menu, browse, (tabbed) edit, and crystal report.  I don't attempt to use the browse for row editing since business apps tend to focus on a specific entity for editing.
My UI's are plain and simple so that I can focus the development resources on the processing model.  I hope to someday allow the simplistic UI to serve both a WinApp and WebApp from a single source code.  For now I focus on WinApps/WebServices and let HTML developers create WebApps against the Xbase++ process engine as desired.
In your example, my UI might allow the user to select an insert action while viewing a browse set which would instance a new entity class with membership in the set and open a edit page on it.  Once saved or cancelled, I would return to the browse. Note that I try to stay within a single, fixed size, stationary (the user can move it, I don't) window for each user focus, but allow the user to popup a new window on page transitions when desired.  Each window is treated as an independent user focus.  I also try to avoid requiring mouse operations. The application is complete when all user focuses are closed and any background operations are finished/cancelled.
Because of the standardized UI, I have not needed the browse to present an empty row for insertion.  If I did need an empty row, I would probably INSERT it in a transaction, refresh the browse, and commit on save/rollback on cancel.
ADS has a nice feature called AOF's which can implement dynamic rowsets pretty efficiently.  If I was less invested in ADS, I would use SqlExpress to access Sql Server as my primary DBE.
Hope something here helps,
Rodd Graham, Consultant
Graham Automation Systems, LLC
Re: Ghost Record
Thanks Boris Borzic

I will testing asap

Best Regards
Osvaldo Ramirez

 wrote:
Osvaldo Ramirez <ramirezosvaldo@yahoo.com> wrote in news:12fa5eab$760aa14d
$cc8f@news.xbwin.com:
In the DBF concept, I can go to ghost record using gobottom+skip, so I > accept new record, but How Can I do using SQL commands ?
if you just want to get default values for the various field data types, then you can use this:
xDefValue := oCursor:GetSQLColumn(i):DefValue
You can then use this to populate a blank row in a browser or a new form in a dialog box.
Best regards,
Boris Borzic