7/8/2025 2:34:22 PM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
|
|
|
|
Data Grid Column Edit
Posted: 12 Nov 09 4:35 AM
|
Hi,
Is there any way to have a column in a data grid that is editable (not readonly) but has no link to an actually field, I want a selectable combobox column but I don't want to affect any backend data I just simply want to refer to the column when a button is clicked.
All help appreciated, this ones killing me.
Cheers Kevin |
|
|
|
Re: Data Grid Column Edit
Posted: 19 Nov 09 12:56 PM
|
Actually I don't think there is....SLX automagically fires off an UPDATE statement after each inline edit to a cell....for EACH changed cell.
So if you have Price (editable) Quantity (editable) Amount(Readonly)
and the user changes Quantity ...... SLX fires off the Update UPDATE MyTable SET QUANTITY = 7 WHERE tableIDFIELD = 'A2EK00010004'
THEN you have to go back into the grid and update the Amount Field with an update statement, and then refresh the grid.
Recall that the grid is based on a live recordset....
I'm afraid that the update statement for your nonexistent writeable 'temp' field would be a problem.....
We cheat....simply add a field to the underlying table (TEMP_INT, TEMP_VALUE are fun choices for field names.....) in the Database Manager and have at it.
|
|
|
|
Re: Data Grid Column Edit
Posted: 19 Nov 09 12:59 PM
|
RJ's cheat is probably the best way to go.
The other alternative is to create your own recordset in code, read the data into from and then link your recordset to the grid, but then off course you also have to do all the updating as well. (This is how the Add Opportunity Poduct functionality works).
Never the less, RJ's approach is my preferred approach as well for this scenario. |
|
|
|
Re: Data Grid Column Edit
Posted: 20 Nov 09 9:33 AM
|
Raul, you seem to be on the right track with the Add Opportunity Product approach, I've tried to interpret it and I've come up with the following:
------
Set rst = CreateObject("ADODB.Recordset")
rst.CursorLocation = adUseClient rst.CursorType = adOpenStatic rst.LockType = adLockOptimistic
rst.Open "SELECT A1.ACCOUNTID, A4.USERID, A5.LASTNAME, A1.ACCOUNT, A2.POSTALCODE, " & _ "A3.REF, SUM(A6.TARGET) OVERALL_TARGET, NULL TRANSFERTO " & _ "FROM ACCOUNT A1 " & _ "LEFT JOIN ADDRESS A2 ON A1.ADDRESSID=A2.ADDRESSID " & _ "LEFT JOIN PY3_ACCOUNT A3 ON A1.ACCOUNTID=A3.ACCOUNTID " & _ "INNER JOIN LGI_ACCRELATIONSHIPS A4 ON A1.ACCOUNTID=A4.ACCOUNTID AND " & _ "A4.USERID Like '%" & lueUser.LookupID & "%' AND " & _ "A4.SOURCE = 'A' " & _ "LEFT JOIN USERINFO A5 ON A4.USERID=A5.USERID " & _ "LEFT JOIN LGI_ACCTARGETS A6 ON A1.ACCOUNTID=A6.ACCOUNTID AND " & _ "A5.DIVISION=A6.DIVISION " & _ "WHERE UPPER(A1.ACCOUNT) Like '" & Ucase(txtAccountNameFilter.Text) & "%' AND " & _ "UPPER(A2.POSTALCODE) Like '" & Ucase(txtPostcodeFilter.Text) & "%' AND " & _ "A3.REF Like '%" & txtREFFilter.Text & "%' " & _ "GROUP BY A1.ACCOUNTID, A4.USERID, A5.LASTNAME, " & _ "A1.ACCOUNT, A2.POSTALCODE, A3.REF " & _ "ORDER BY A1.ACCOUNT, A2.POSTALCODE, A5.LASTNAME", conn
dgAccountTransfer.Recordset = rst
------
As you can see I'm trying to simply create a column in the data grid that is not linked to a field but can be used for selection in a picklist column (I've defaulted it to NULL in this instance). I can select an option from the picklist that is bound to this column but it does not populate the data. |
|
|
|
Re: Data Grid Column Edit
Posted: 20 Nov 09 10:02 AM
|
Your approach is not exactly what I had suggested. This is what the Add Opp Product does:
a) Build a Custom Recordset: - Create the object - Add Columns with the Correct Data Type
b) Query the data (this would go into a separate recordset)
c) Loop through the recordset with the data, and populate the matching fields on the Custom recordset. Then close the recordset.
d) Associate the Custom Recordset to the Datagrid
e) As changes are made to the data, keep track of the changed data on a separate recordset
f) On Save, use the Separate recordset to figure out what needs to be written to the database (This includes adds/Updates and Deletes)
Because this is a complex approach, I also stated that I liked RJ's approach for simplicity's sake in your circumstances, but off course, that is with the limited amount of information I have regarding your customization |
|
|
|
Re: Data Grid Column Edit
Posted: 20 Nov 09 10:56 AM
|
Raul, that's exactly what I'm after because the data they populate has no existing records to start with so I don't want to go through the process of creating a record and refreshing everytime they go to edit a selection. Why I didn't think of this I don't know but my head has been rattling on datagrids for about a week so I think I'm losing my mind.
Thanks everyone for your help, greatly appreciated. |
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|