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!
|
|
Grid.GetCurrentField
Posted: 29 May 08 3:20 PM
|
I created a new Contact level tab with a datagrid. I am trying to pull the first field from the grid to use in a query for a second grid. I am using dg.getcurrentfield and displaying the value in a message box to make sure it is returning the correct data, but I cannot get the getcurrentfield to pull the value. The field I am trying to pull is populated in my grid. I have the same grid on at the Account level and it is working great. Any suggestions would be greatly appreciated............Thanks!! |
|
|
|
Re: Grid.GetCurrentField
Posted: 29 May 08 5:25 PM
|
What is it returning for you? Is it blank or ???
FYI - Just wanted to make sure you're clear that GetCurrentField is meant to return a value from the "selected" row, not the first one. Could that be where things are going wrong? |
|
|
|
Re: Grid.GetCurrentField
Posted: 29 May 08 9:12 PM
|
Yes, the return is blank. I have this fire on the form open event, and it also fires on the row select event so I can use the value as a condition in my SQL stmt. The same function is working great on the Account level tab that I created. |
|
|
|
Re: Grid.GetCurrentField
Posted: 29 May 08 9:21 PM
|
I would expect that on the form open event that it *would* be blank as the user hasn't "selected" any row yet? |
|
|
|
Re: Grid.GetCurrentField
Posted: 30 May 08 8:01 AM
|
I also tried it on the form change event and it returns a blank. I would think that it should be returning a value when it fires on the OnRowSelect event, that is what has me confused. When I set the .getcurrentfield value to a message box onrowselect the value is empty but the field in the grid contains data. |
|
|
|
Re: Grid.GetCurrentField
Posted: 30 May 08 8:33 AM
|
Make sure you are using the field alias in the getcurrentfield call and not the field name - i.e. if you have more than 2 tables joined, one will get the alias a2 and the sql from the grid would look like:
select a1.fieldname, a2.fielname a2_fieldname from table1 inner join table2 etc, etc.
when using getcurrentfield you have to reference the alias grid.Getcurrentfield("a2_fieldname") NOT grid.GetCurrentfield("a2.fieldname") |
|
|
|
Re: Grid.GetCurrentField
Posted: 30 May 08 9:06 AM
|
Another way I discovered by accident was by moving the field I needed to the first field in the grid, then when I run the .GetCurrentField I don't pass any field Id and it returns the data. Another issue I ran into is getting the application.BasicFunctions.CurrentContactID to return the Contact Id. When I am on a Contact Tab and set msgbox application.BasicFunctions.CurrentContactID no Id is returned. |
|
|
|
Re: Grid.GetCurrentField
Posted: 30 May 08 2:54 PM
|
Did you try my suggestion?
Application.BasicFunctions.CurrentContactID won't return anything unless the contact mainview is already open. |
|
|
|