Subject | Edit fields in grid supplied by Stored Procedure |
---|---|
Author | Michael L. Horne |
Post date | 2005-10-12T21:22:20Z |
Hello,
I have a IB_Grid that I am populating from a stored procedure,
I use the updateSQL to update the underlying table fields when
they are edited. But I have a couple of problems:
1. When a field is edited and the user moves to the next record
the changes they made to that field vanish from the screen.
They where made to the underlying files, and a refresh will cause
them to reappear. How do I get them to stay?
2. A character field that we use for a Boolean (T,F) displays
as a checkbox but when we click on it, it cycles through 3 states
"gray checked", "checked", and "blank". I am just expecting
to have "checked", and "blank". The "gray checked" seems to be
null. I have set:
ColumnAttributes.Strings = ('OD_INCOMING_RECVD=NOTNULL;BOOLEAN=T,F')
but that hasn't solved the problem. How do I stop this?
Below is the relevant code.
Thanks
Michael L. Horne
object gridOrdersM: TIB_Grid
Left = 0
Top = 49
Width = 1018
Height = 333
CustomGlyphsSupplied = []
DataSource = dsSP
Align = alClient
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
BorderStyle = bsNone
TabOrder = 2
IndicateRow = False
CurrentRowFont.Charset = ANSI_CHARSET
CurrentRowFont.Color = clWindowText
CurrentRowFont.Height = -12
CurrentRowFont.Name = 'Arial'
CurrentRowFont.Style = []
OrderingFont.Charset = ANSI_CHARSET
OrderingFont.Color = clWindowText
OrderingFont.Height = -12
OrderingFont.Name = 'Arial'
OrderingFont.Style = []
FixedFont.Charset = ANSI_CHARSET
FixedFont.Color = clWindowText
FixedFont.Height = -13
FixedFont.Name = 'Arial Narrow'
FixedFont.Style = []
OnGetCellProps = gridOrdersMGetCellProps
end
object qySP: TIB_Query
ColumnAttributes.Strings = (
'OD_INCOMING_RECVD=NOTNULL;BOOLEAN=T,F')
DatabaseName = 'C:\Offroad\IB\ORInventory.gdb'
FieldsCharCase.Strings = (
'OD_INCOMING_NOTES=UPPER')
FieldsDisplayLabel.Strings = (
'OD_PART=Part'
'OD_DESCR=Descr'
'OD_ORDQTY=Qty'
'OM_COMPANY=Customer'
'POS_SHIPVIA=ShipVia'
'OD_INCOMING_RECVD=Recvd'
'OD_INCOMING_NOTES=Notes'
'VENDOR=Vendor'
'POM_DATE=Date'
'POM_OM_ID=Order#'
'POM_STATUS=OS'
'POM_ID=PO#')
FieldsDisplayWidth.Strings = (
'POM_DATE=70'
'OD_PART=69'
'OD_DESCR=110'
'OD_ORDQTY=35'
'OD_INCOMING_NOTES=86'
'OD_INCOMING_RECVD=24'
'POS_SHIPVIA=90'
'POM_STATUS=32'
'POM_OM_ID=57'
'OM_COMPANY=214')
FieldsIndex.Strings = (
'POM_DATE'
'VENDOR'
'OD_PART'
'OD_DESCR'
'OD_ORDQTY'
'OM_COMPANY'
'POM_OM_ID'
'OD_INCOMING_NOTES'
'OD_INCOMING_RECVD'
'POS_SHIPVIA'
'POM_ID'
'POM_STATUS'
'POM_SHIPTOUS'
'POM_APVEN_ID'
'BROKERED'
'OD_ID')
FieldsReadOnly.Strings = (
'OD_ORDQTY=TRUE;NOEDIT'
'OD_DESCR=TRUE;NOEDIT'
'OD_PART=TRUE;NOEDIT'
'OM_COMPANY=TRUE;NOEDIT'
'OD_ID=TRUE;NOEDIT'
'POS_SHIPVIA=TRUE;NOEDIT'
'BROKERED=TRUE;NOEDIT'
'VENDOR=TRUE;NOEDIT'
'POM_DATE=TRUE;NOEDIT'
'POM_OM_ID=TRUE;NOEDIT'
'POM_APVEN_ID=TRUE;NOEDIT'
'POM_SHIPTOUS=TRUE;NOEDIT'
'POM_STATUS=TRUE;NOEDIT'
'POM_ID=TRUE;NOEDIT')
FieldsVisible.Strings = (
'OD_ID=FALSE'
'BROKERED=FALSE'
'POM_SHIPTOUS=FALSE'
'OD_INCOMING_RECVD=TRUE'
'POM_APVEN_ID=FALSE'
'POM_ID=FALSE'
'OD_INCOMING_NOTES=TRUE'
'POM_STATUS=FALSE')
IB_Connection = formIBData.cnMain
SQL.Strings = (
'select *'
'from spincomingshipments ')
CheckRequired = False
ColorScheme = True
EditSQL.Strings = (
'UPDATE ORDERSD SET'
' OD_INCOMING_NOTES = :OD_INCOMING_NOTES,'
' OD_INCOMING_RECVD = :OD_INCOMING_RECVD'
'WHERE'
'OD_ID = :OD_ID')
GetServerDefaults = True
MasterSearchFlags = [msfOpenMasterOnOpen, msfSearchMasterOnSearch,
msfSearchAppliesToMasterOnly]
OrderingItemNo = 1
OrderingItems.Strings = (
'Vendor=VENDOR,POM_ID,od_id;VENDOR DESC,POM_ID DESC,od_id desc'
'PO=POM_ID,od_id;POM_ID DESC,od_id desc'
'Part=OD_PART,od_id;OD_PART DESC,od_id desc'
'Customer=OM_COMPANY,POM_ID,od_id;OM_COMPANY DESC,POM_ID DESC,od_' +
'id desc'
'Order=POM_OM_ID,od_id;POM_OM_ID DESC,od_id desc'
'Shipped By=POS_SHIPVIA,POM_ID, od_id;POS_SHIPVIA DESC,POM_ID DES' +
'C,od_id desc'
'Date=POM_DATE,POM_ID,od_id;POM_DATE DESC,POM_ID DESC,od_id desc'
'Status=POM_STATUS,POM_ID,od_id;POM_STATUS DESC,POM_ID DESC,od_id' +
' desc')
OrderingLinks.Strings = (
'VENDOR=ITEM=1'
'POM_ID=ITEM=2'
'OD_PART=ITEM=3'
'OM_COMPANY=ITEM=4'
'POM_OM_ID=ITEM=5'
'POS_SHIPVIA=ITEM=6'
'POM_DATE=ITEM=7'
'POM_STATUS=ITEM=8')
RefreshAction = raKeepDataPos
BufferSynchroFlags = [bsAfterEdit, bsAfterInsert]
CommitAction = caRefresh
Left = 416
Top = 104
end
------------------------------------
CREATE PROCEDURE SPINCOMINGSHIPMENTS
RETURNS (
POM_ID INTEGER,
POM_STATUS CHAR (1) CHARACTER SET NONE,
POM_SHIPTOUS CHAR (1) CHARACTER SET NONE,
POM_APVEN_ID INTEGER,
POM_OM_ID INTEGER,
POM_DATE DATE,
VENDOR VARCHAR (35) CHARACTER SET NONE,
BROKERED CHAR (1) CHARACTER SET NONE,
OM_COMPANY VARCHAR (35) CHARACTER SET NONE,
OD_ID INTEGER,
OD_PART VARCHAR (16) CHARACTER SET NONE,
OD_DESCR VARCHAR (16) CHARACTER SET NONE,
OD_ORDQTY INTEGER,
OD_INCOMING_NOTES VARCHAR (35) CHARACTER SET NONE,
OD_INCOMING_RECVD CHAR (1) CHARACTER SET NONE,
POS_SHIPVIA VARCHAR (70) CHARACTER SET NONE)
AS
Begin
/* First find an order that is in status P */
for select pom_id, pom_status, pom_shiptous, pom_apven_id, pom_om_id,
pom_date
FROM POM
WHERE (POM_SHIPTOUS = 'T')
AND (POM_STATUS = 'P')
INTO :POM_ID, :POM_STATUS, :POM_SHIPTOUS, :POM_APVEN_ID, :POM_OM_ID,
:POM_DATE
do begin
VENDOR = '';
BROKERED = 'F';
select apven_company, apven_brokered
FROM apvendor
WHERE (:POM_APVEN_ID = apven_id)
INTO :VENDOR, :BROKERED;
OM_COMPANY = '';
select om_company
FROM ordersm
WHERE (:POM_OM_ID = om_id)
INTO :OM_COMPANY;
POS_SHIPVIA = '';
select pos_shipvia
FROM poship
WHERE (:POM_ID = pos_pom_id)
INTO :pos_shipvia;
for select od_id, od_part, od_descr, od_ordqty, od_incoming_notes,
od_incoming_recvd
FROM ordersd
WHERE (:POM_OM_ID = od_om_id)
AND (:POM_ID = od_pom_id)
AND (od_ordqty <> 0)
INTO :OD_ID, :OD_PART, :OD_DESCR, :OD_ORDQTY, :OD_INCOMING_NOTES,
:OD_INCOMING_RECVD
do begin
suspend;
end
end
end
I have a IB_Grid that I am populating from a stored procedure,
I use the updateSQL to update the underlying table fields when
they are edited. But I have a couple of problems:
1. When a field is edited and the user moves to the next record
the changes they made to that field vanish from the screen.
They where made to the underlying files, and a refresh will cause
them to reappear. How do I get them to stay?
2. A character field that we use for a Boolean (T,F) displays
as a checkbox but when we click on it, it cycles through 3 states
"gray checked", "checked", and "blank". I am just expecting
to have "checked", and "blank". The "gray checked" seems to be
null. I have set:
ColumnAttributes.Strings = ('OD_INCOMING_RECVD=NOTNULL;BOOLEAN=T,F')
but that hasn't solved the problem. How do I stop this?
Below is the relevant code.
Thanks
Michael L. Horne
object gridOrdersM: TIB_Grid
Left = 0
Top = 49
Width = 1018
Height = 333
CustomGlyphsSupplied = []
DataSource = dsSP
Align = alClient
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Arial'
Font.Style = []
ParentFont = False
BorderStyle = bsNone
TabOrder = 2
IndicateRow = False
CurrentRowFont.Charset = ANSI_CHARSET
CurrentRowFont.Color = clWindowText
CurrentRowFont.Height = -12
CurrentRowFont.Name = 'Arial'
CurrentRowFont.Style = []
OrderingFont.Charset = ANSI_CHARSET
OrderingFont.Color = clWindowText
OrderingFont.Height = -12
OrderingFont.Name = 'Arial'
OrderingFont.Style = []
FixedFont.Charset = ANSI_CHARSET
FixedFont.Color = clWindowText
FixedFont.Height = -13
FixedFont.Name = 'Arial Narrow'
FixedFont.Style = []
OnGetCellProps = gridOrdersMGetCellProps
end
object qySP: TIB_Query
ColumnAttributes.Strings = (
'OD_INCOMING_RECVD=NOTNULL;BOOLEAN=T,F')
DatabaseName = 'C:\Offroad\IB\ORInventory.gdb'
FieldsCharCase.Strings = (
'OD_INCOMING_NOTES=UPPER')
FieldsDisplayLabel.Strings = (
'OD_PART=Part'
'OD_DESCR=Descr'
'OD_ORDQTY=Qty'
'OM_COMPANY=Customer'
'POS_SHIPVIA=ShipVia'
'OD_INCOMING_RECVD=Recvd'
'OD_INCOMING_NOTES=Notes'
'VENDOR=Vendor'
'POM_DATE=Date'
'POM_OM_ID=Order#'
'POM_STATUS=OS'
'POM_ID=PO#')
FieldsDisplayWidth.Strings = (
'POM_DATE=70'
'OD_PART=69'
'OD_DESCR=110'
'OD_ORDQTY=35'
'OD_INCOMING_NOTES=86'
'OD_INCOMING_RECVD=24'
'POS_SHIPVIA=90'
'POM_STATUS=32'
'POM_OM_ID=57'
'OM_COMPANY=214')
FieldsIndex.Strings = (
'POM_DATE'
'VENDOR'
'OD_PART'
'OD_DESCR'
'OD_ORDQTY'
'OM_COMPANY'
'POM_OM_ID'
'OD_INCOMING_NOTES'
'OD_INCOMING_RECVD'
'POS_SHIPVIA'
'POM_ID'
'POM_STATUS'
'POM_SHIPTOUS'
'POM_APVEN_ID'
'BROKERED'
'OD_ID')
FieldsReadOnly.Strings = (
'OD_ORDQTY=TRUE;NOEDIT'
'OD_DESCR=TRUE;NOEDIT'
'OD_PART=TRUE;NOEDIT'
'OM_COMPANY=TRUE;NOEDIT'
'OD_ID=TRUE;NOEDIT'
'POS_SHIPVIA=TRUE;NOEDIT'
'BROKERED=TRUE;NOEDIT'
'VENDOR=TRUE;NOEDIT'
'POM_DATE=TRUE;NOEDIT'
'POM_OM_ID=TRUE;NOEDIT'
'POM_APVEN_ID=TRUE;NOEDIT'
'POM_SHIPTOUS=TRUE;NOEDIT'
'POM_STATUS=TRUE;NOEDIT'
'POM_ID=TRUE;NOEDIT')
FieldsVisible.Strings = (
'OD_ID=FALSE'
'BROKERED=FALSE'
'POM_SHIPTOUS=FALSE'
'OD_INCOMING_RECVD=TRUE'
'POM_APVEN_ID=FALSE'
'POM_ID=FALSE'
'OD_INCOMING_NOTES=TRUE'
'POM_STATUS=FALSE')
IB_Connection = formIBData.cnMain
SQL.Strings = (
'select *'
'from spincomingshipments ')
CheckRequired = False
ColorScheme = True
EditSQL.Strings = (
'UPDATE ORDERSD SET'
' OD_INCOMING_NOTES = :OD_INCOMING_NOTES,'
' OD_INCOMING_RECVD = :OD_INCOMING_RECVD'
'WHERE'
'OD_ID = :OD_ID')
GetServerDefaults = True
MasterSearchFlags = [msfOpenMasterOnOpen, msfSearchMasterOnSearch,
msfSearchAppliesToMasterOnly]
OrderingItemNo = 1
OrderingItems.Strings = (
'Vendor=VENDOR,POM_ID,od_id;VENDOR DESC,POM_ID DESC,od_id desc'
'PO=POM_ID,od_id;POM_ID DESC,od_id desc'
'Part=OD_PART,od_id;OD_PART DESC,od_id desc'
'Customer=OM_COMPANY,POM_ID,od_id;OM_COMPANY DESC,POM_ID DESC,od_' +
'id desc'
'Order=POM_OM_ID,od_id;POM_OM_ID DESC,od_id desc'
'Shipped By=POS_SHIPVIA,POM_ID, od_id;POS_SHIPVIA DESC,POM_ID DES' +
'C,od_id desc'
'Date=POM_DATE,POM_ID,od_id;POM_DATE DESC,POM_ID DESC,od_id desc'
'Status=POM_STATUS,POM_ID,od_id;POM_STATUS DESC,POM_ID DESC,od_id' +
' desc')
OrderingLinks.Strings = (
'VENDOR=ITEM=1'
'POM_ID=ITEM=2'
'OD_PART=ITEM=3'
'OM_COMPANY=ITEM=4'
'POM_OM_ID=ITEM=5'
'POS_SHIPVIA=ITEM=6'
'POM_DATE=ITEM=7'
'POM_STATUS=ITEM=8')
RefreshAction = raKeepDataPos
BufferSynchroFlags = [bsAfterEdit, bsAfterInsert]
CommitAction = caRefresh
Left = 416
Top = 104
end
------------------------------------
CREATE PROCEDURE SPINCOMINGSHIPMENTS
RETURNS (
POM_ID INTEGER,
POM_STATUS CHAR (1) CHARACTER SET NONE,
POM_SHIPTOUS CHAR (1) CHARACTER SET NONE,
POM_APVEN_ID INTEGER,
POM_OM_ID INTEGER,
POM_DATE DATE,
VENDOR VARCHAR (35) CHARACTER SET NONE,
BROKERED CHAR (1) CHARACTER SET NONE,
OM_COMPANY VARCHAR (35) CHARACTER SET NONE,
OD_ID INTEGER,
OD_PART VARCHAR (16) CHARACTER SET NONE,
OD_DESCR VARCHAR (16) CHARACTER SET NONE,
OD_ORDQTY INTEGER,
OD_INCOMING_NOTES VARCHAR (35) CHARACTER SET NONE,
OD_INCOMING_RECVD CHAR (1) CHARACTER SET NONE,
POS_SHIPVIA VARCHAR (70) CHARACTER SET NONE)
AS
Begin
/* First find an order that is in status P */
for select pom_id, pom_status, pom_shiptous, pom_apven_id, pom_om_id,
pom_date
FROM POM
WHERE (POM_SHIPTOUS = 'T')
AND (POM_STATUS = 'P')
INTO :POM_ID, :POM_STATUS, :POM_SHIPTOUS, :POM_APVEN_ID, :POM_OM_ID,
:POM_DATE
do begin
VENDOR = '';
BROKERED = 'F';
select apven_company, apven_brokered
FROM apvendor
WHERE (:POM_APVEN_ID = apven_id)
INTO :VENDOR, :BROKERED;
OM_COMPANY = '';
select om_company
FROM ordersm
WHERE (:POM_OM_ID = om_id)
INTO :OM_COMPANY;
POS_SHIPVIA = '';
select pos_shipvia
FROM poship
WHERE (:POM_ID = pos_pom_id)
INTO :pos_shipvia;
for select od_id, od_part, od_descr, od_ordqty, od_incoming_notes,
od_incoming_recvd
FROM ordersd
WHERE (:POM_OM_ID = od_om_id)
AND (:POM_ID = od_pom_id)
AND (od_ordqty <> 0)
INTO :OD_ID, :OD_PART, :OD_DESCR, :OD_ORDQTY, :OD_INCOMING_NOTES,
:OD_INCOMING_RECVD
do begin
suspend;
end
end
end