6/20/2025 12:28:12 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.
|
|
|
|
Datagrid returning Invalid Record
Posted: 28 Feb 07 9:05 PM
|
fiogf49gjkf0d I've looked at this tooooo long.
Here's the code... but it's returning an invalid record. Any ideas why? The datagrid is not bound to anything, as you can tell, it's very similar to the System:Select Contacts
Sub Init(objRS, Mode) Dim strSQL, strWhere, strResult, strIDs Dim objContactRS, objAccountID Dim i
Set objSLXDB = New SLX_DB strAddEdit = Mode
SetDefaultValues BuildDataGrid(objRS)
'.....
Set objContactRS = objSLXDB.GetNewRecordSet strSQL = "Select CONTACTID, NAME, TITLE, WORKPHONE, TYPE, ISPRIMARY " _ & "From CONTACT " _ & strWhere
objContactRS.Open strSQL & "Order by NAME", objSLXDB.Connection 'DNL
grdBuyerContacts.Recordset = objContactRS
grdBuyerContacts.Refresh Set objRS = Nothing Set objContactRS = Nothing
End Sub
Sub SetDefaultValues cboFilterBy.ItemIndex = 0 cboCriteria.ItemIndex = 2 End Sub
Sub BuildDataGrid(objRS) Dim col Dim i
Set objRS = objSLXDB.GetNewRecordSet 'Define Fields with objRS
.Fields.Append "CONTACTID", adVarChar, 16 'DNL .Fields.Append "NAME", adVarChar, 64 'DNL .Fields.Append "ACCOUNT", adVarChar, 128 'DNL .Fields.Append "TITLE", adVarChar, 64 'DNL .Fields.Append "WORKPHONE", adVarChar, 32 'DNL .Fields.Append "TYPE", adVarChar, 128 'DNL .Fields.Append "ISPRIMARY", adVarChar, 128 'DNL
.Open End With 'Define Fields With grdBuyerContacts Set .Recordset = objRS If (.Columns.Count > 0) Then For i = 0 To .Columns.Count - 1 .Columns.Item(0).Delete Next End If
'Contact ID Set col = .Columns.Add(0) col.FieldName = "CONTACTID" 'DNL col.Visible = False 'Contact Name Set col = .Columns.Add(0) col.FieldName = "NAME" 'DNL col.Caption = Application.Translator.Localize("Name") col.Width = 125 'Account Name Set col = .Columns.Add(0) col.FieldName = "ACCOUNT" 'DNL col.Caption = Application.Translator.Localize("Account") col.Width = 125 'Title Set col = .Columns.Add(0) col.FieldName = "TITLE" 'DNL col.Caption = Application.Translator.Localize("Title") col.Width = 125 'Phone Number Set col = .Columns.Add(0) col.FieldName = "WORKPHONE" 'DNL col.Caption = Application.Translator.Localize("Phone") col.Width = 75 col.FormatType = 7 'IsPrimary Set col = .Columns.Add(0) col.FieldName = "ISPRIMARY" 'DNL col.Caption = Application.Translator.Localize("IsPrimary") col.Width = 125 col.Visible = False 'Type Set col = .Columns.Add(0) col.FieldName = "TYPE" 'DNL col.Caption = Application.Translator.Localize("Type") col.Width = 125 col.Visible = False End With
Set objRS = Nothing End Sub |
|
|
| |
|
Re: Datagrid returning Invalid Record
Posted: 01 Mar 07 6:31 AM
|
fiogf49gjkf0d I can't quite decipher the logic in how objRS is handled. You pass objRS to the Sub Init method, but where was it declared, at the module level? Then you have pass objRS to the BuildDataGrid method, and the method signature has the same name - objRS. Within BuildDataGrid, you're setting objRS to a new recordset, then handling the datagrid column stuff, and setting objRS = Nothing. But back in Init, at the end you also set objRS = Nothing. Seems there is something off about the logic surrounding objRS. |
|
|
|
Re: Datagrid returning Invalid Record
Posted: 01 Mar 07 12:18 PM
|
fiogf49gjkf0d Are you saying that you're getting back records that are not the ones you're expecting? If so then that would come down to your strWhere variable. If you're saying that you're getting an error, then Mike's suggestion (no NAME column) would make most sense. |
|
|
|
Re: Datagrid returning Invalid Record
Posted: 04 Mar 07 9:38 PM
|
fiogf49gjkf0d Sorry for the delayed response guys... Yes Name is a valid "calculated" field that the OLEDB does handle ok. And the results provided by the SLXProfiler are correct. The dialog box opens, the grid does not show, nor does the three fields you would normally see at the top of the System:Add Contacts view. It just displays "Invalid Record", with no datagrid at all.
One thing I thought of and haven't played with yet, I pass to TAXForm.CURRENTID the AccountID, that I use to get the contacts for that particular account.
I did a very similar view to add team members successfully, just can't get my head around this one.
Thanks guys, Ron |
|
|
|
Re: Datagrid returning Invalid Record
Posted: 04 Mar 07 11:56 PM
|
fiogf49gjkf0d Are you saying you get an error message box saying "invalid record" or something?
You don't see the controls on the form at all, but the dialog does in fact open? |
|
|
|
Re: Datagrid returning Invalid Record
Posted: 05 Mar 07 9:54 PM
|
fiogf49gjkf0d Hi Ryan, Yup, that's it. Under 7.0 we occasionally see it when your changing from Acount to Contact view. And I've seen the same response when there's been a null value (like the issue with the address table). It's not even a messagbox... just the form and in the middle it says "Invalid Record". Yes the form opens, but no controls at all.
Thanks, Ron |
|
|
|
Re: Datagrid returning Invalid Record
Posted: 06 Mar 07 7:38 AM
|
fiogf49gjkf0d Well, we've seen this too.. And what I've found out is this... Patience! For whatever reason, when changing from the Account to the Opportunity or Contact windows (or back and forth from any of the others) the 'Invalid Record' will appear in the middle of the screen.
This is a VERY misleading message! If you just sit and wait for about 30 seconds or longer, the account, opportunity or contact you were expecting to appear will appear!
This was not a problem with our 6.2.1 which was the version we previously used. All I've been able to do is tell the users to wait until the 'system catches up'
Just a new feature (annoyance) from what I can tell. One I'll definitely be on the phone with support about.
John G. |
|
|
|
Re: Datagrid returning Invalid Record
Posted: 07 Mar 07 6:08 AM
|
fiogf49gjkf0d I noticed the same behaviour when you select an opportunity under the account main view. If you have more then 1 opportunity it will create an lookup to all opportunities for that account, showing the selected opportunity in detailed view.
Look at my the line starting with "=>" in the function OpenMainViewFromGridCrntID(objGrid, strKeyField, strPlugin, intMode, blnExisting) defined in SLX_Common. As you can see the RecordID is set to "Invalid". This is why you see the "Invalid Record".
'Iterates the the grids recordset object to build a list of ID's, then creates a new group based on the list, then displays the current record 'objGrid - Grid object 'strKeyField - Name of the primary KeyField for the grid 'strPlugin - Name of the MainView plugin to be opened 'intMode - Window style the MainView will be opened with 'blnExisting - Specifies whether to open a new instance of the MainView or open an existing instance if exists Sub OpenMainViewFromGridCrntID(objGrid, strKeyField, strPlugin, intMode, blnExisting) const MaxCount = 250 'ShowIDsAsLookupResult API call may fail for counts larger than this. The call creates an in clause with all of the 'requested ID's and at some point will be to large for the underlying db provider to handle Dim strIDList, strCrntID Dim objMainView Dim i
If objGrid.RecordSet.RecordCount > 0 Then strCrntID = objGrid.GetCurrentField(strKeyField) If intMode = 2 Then Set objMainView = Application.MainViews For i = 0 To objMainView.Count - 1 If objMainView.Item(i).CurrentID = strCrntID Then objMainView.Item(i).BringToFront Exit Sub End If Next Set objMainView = Application.MainViews.AddEx(strPlugin, intMode, blnExisting, 1, strCrntID, "") 'DNL objMainView.CaptionBarVisible = False objMainView.Show Else If strCrntID <> "" Then If objGrid.Recordset.RecordCount > MaxCount Then strIDList = "('" & strCurrentID & "')" 'DNL Else strIDList = RemoveParenthesisFromStr(GetListFromGridByField(objGrid.Recordset, strKeyField)) End If 'We're passing an invalid RecordID so to avoid multiple refreshes to the mainview. => Application.MainViews.AddEx strPlugin, intMode, blnExisting, 1, "Invalid", "" 'DNL Application.MainViews.ActiveView.ShowIDsAsLookupResult strIDList, strCrntID 'DNL End If End If End If End Sub |
|
|
| |
|
Re: Datagrid returning Invalid Record
Posted: 07 Mar 07 10:31 AM
|
fiogf49gjkf0d I had spoken to SLX support about this and it was stated that this was something they've noticed since 7.0. To me its more of an annoyance than anything because I get users complaining about it.
If anything, I'll be submitting a feature request to SLX asking that when changing between accounts, contacts, opportunities and lead to not diplay the 'Invalid Record' message and instead put something more logical up there like
Retrieving Data. Please Wait...
That would be the best solution IMHO.
John G. |
|
|
| |
|
Re: Datagrid returning Invalid Record
Posted: 07 Mar 07 3:23 PM
|
fiogf49gjkf0d Problem Isolated.... It took too long, but here was the problem child. The dialog did NOT like me seeing the CurrentID while calling the view. But at least it brought to light that the pesky "Invalid Record" needs to be corrected!
Thanks to you all for input. By the way, CONTEXT is a great editor that allows side-by-side comparisons of code. I looked at this code a few times without catching the glaring error... shows up highlighted in CONTEXT comparison.
Set objMainView = Application.MainViews.Add("System:Select Buyer Contact(s)", 0, False) 'DNL ==> objMainView.CurrentID = grdOppAccounts.GetCurrentField("ACCOUNTID") 'DNL objMainView.Caption = Application.Translator.Localize("Select Buyer Contact(s)") 'objMainView.BorderStyle = 3 Set objDetail = objMainView.DetailsView
'objDetail.ppeLookupContact.Text = frmOppContact.Parent.DetailsView.lnkAccount.Text objDetail.ppeLookupContact.Text = grdOppAccounts.GetCurrentField("ACCOUNT") 'DNL |
|
|
|
Re: Datagrid returning Invalid Record
Posted: 25 Sep 07 11:52 AM
|
Not to beat an old horse (module) but my issue is the MaxRecord = 250. What if there are more than 250 opportunities/contacts from a datagrid? We are not going to at least show the most recent 250 records? Instead we just show the one and only one?
Or is this 250 REALLY the maximum? Has anyone pushed it past? I am testing at 350 right now. And if so, what are the implications?
|
|
|
|
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!
|
|
|
|
|
|
|
|