You are so close Bruce!
Actually I dont need to send data back to the database.
Thats done with a DataBrowser that displays and updates the entire database.
This is a separate entity that gets SOME data form the database IF the
daysLeft field in the database is less than a certain amount, 20 days
for example.
I want it to retrieve and only retrieve 4 fields form the database.
I would like to use a DataViewer as I think that would be easier, but
wasn't sure if the DataViewer could do that.
The user would click a button and a new form would show the data.

Sorry my code doesn't show the IF Then statement that is actually a
requirement that I'm seeking, oops my bad.

On 09/29/2012 03:38 AM, Bruce wrote:
> On Fri, 2012-09-28 at 20:11 -0700, rocko wrote:
>> Ok that makes a little more sense.
>> But I have some questions.
>>
>> Do I have to use a TableView?
> Well that depends on whether you want to have some sort of display of
> the data at all.  If you just want to update the data, say on a daily
> basis, then you can just use the result cursor itself.  There is no need
> to display result!myfield if all you want to do is change its' value.
> 
>> Originally I used DataView but that displays all
>> the fields in the database, I just want to use some
>> of the fields if certain conditions apply, like
>> if the 'Days Left' field is less than 20 days.
>>
>> Then if so display just 4 fields in a separate
>> Dataview/TableView.
> OK, I think I got the idea of what you are trying to do.  Just to
> confirm, is it:
> a) load a result cursor with a set of records where 'Days Left' is less
> than 20 days
> b) display that set of rows to the user in some way
> c) make some sort of update to the data displayed (I'm still not sure
> here as your example code does not seem to show any update?)
> d) At some point, update the data back to the database.
> 
> d) is somewhat worrying as you said "when the form opens".  I think
> there is still some sort of requirement you haven't revealed here?
> 
>> Now exactly what is the 'idx' variable you used?
>> Is it just an integer used to count thru the loop.
> Yes
>>
>> I ask cause I tried your example and it's not working.
>> I don't get any error's, just the TableView is not being
>> filled with any data.
> The example was just a "skeleton" code, you need to fill it out with all
> the things you need to do to 
> a) display the data
> b) change the data
> c) update the data, and 
> d) save the data back to the database.
>>
>>
>> On 09/28/2012 07:39 PM, Bruce wrote:
>>> On Fri, 2012-09-28 at 19:27 -0700, rocko wrote:
>>>> Huh?
>>>> I'm sorry Bruce I'm not following.
>>>> I want the fields to update when the form opens.
>>>> Just the ID, Location and Days Left fields.
>>>>
>>> Unless a row is selected in the tableview, Tableview1.Row will be -1.
>>> (You can check that in the debugger.)  So your sResult!location =
>>> TableView1[TableView1.Row, 1].Text line reports the Bad Row Index error
>>> as TableView1[-1, 1].Text is incorrect.
>>> If you want the update to happen automatically when the form opens you
>>> will have to iterate through the rows of the tableview explicitly. As
>>> in 
>>> For idx = 0 to TableView1.Rows.Max
>>>   ...
>>>   sResult!location = TableView1[idx, 1].Text
>>>   ...
>>> Next
>>>
>>> Bruce
>>>
>>>
>>>>
>>>> On 09/28/2012 07:17 PM, Bruce wrote:
>>>>> On Fri, 2012-09-28 at 18:55 -0700, rocko wrote:
>>>>>> I get a "Bad Row Index" error when I do that.
>>>>>>
>>>>>>
>>>>>> On 09/28/2012 12:07 AM, Алексей Беспалов wrote:
>>>>>>> It do that:
>>>>>>>
>>>>>>>  sResult = DB.Edit("inventory", id = &1, ID)
>>>>>>>   sResult!id = ID
>>>>>>>   'sResult!location = TableView1.Columns[1].
>>>>>       If TableView1.Row < 0 then Error.Raise("You haven't selected a row
>>>>> in the tableview yet!")
>>>>>>> *  sResult!location = TableView1[TableView1.Row, 1].Text*
>>>>>>>   sResult.Update
>>>>>>>
>>>>>
>>>>> hth
>>>>> Bruce
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> How fast is your code?
>>>>> 3 out of 4 devs don\\\'t know how their code performs in production.
>>>>> Find out how slow your code is with AppDynamics Lite.
>>>>> http://ad.doubleclick.net/clk;262219672;13503038;z?
>>>>> http://info.appdynamics.com/FreeJavaPerformanceDownload.html
>>>>> _______________________________________________
>>>>> Gambas-user mailing list
>>>>> Gambas-user@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> How fast is your code?
>>>> 3 out of 4 devs don\\\'t know how their code performs in production.
>>>> Find out how slow your code is with AppDynamics Lite.
>>>> http://ad.doubleclick.net/clk;262219672;13503038;z?
>>>> http://info.appdynamics.com/FreeJavaPerformanceDownload.html
>>>> _______________________________________________
>>>> Gambas-user mailing list
>>>> Gambas-user@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> How fast is your code?
>>> 3 out of 4 devs don\\\'t know how their code performs in production.
>>> Find out how slow your code is with AppDynamics Lite.
>>> http://ad.doubleclick.net/clk;262219672;13503038;z?
>>> http://info.appdynamics.com/FreeJavaPerformanceDownload.html
>>> _______________________________________________
>>> Gambas-user mailing list
>>> Gambas-user@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>>
>>
>> ------------------------------------------------------------------------------
>> How fast is your code?
>> 3 out of 4 devs don\\\'t know how their code performs in production.
>> Find out how slow your code is with AppDynamics Lite.
>> http://ad.doubleclick.net/clk;262219672;13503038;z?
>> http://info.appdynamics.com/FreeJavaPerformanceDownload.html
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
> 
> 
> 
> ------------------------------------------------------------------------------
> How fast is your code?
> 3 out of 4 devs don\\\'t know how their code performs in production.
> Find out how slow your code is with AppDynamics Lite.
> http://ad.doubleclick.net/clk;262219672;13503038;z?
> http://info.appdynamics.com/FreeJavaPerformanceDownload.html
> _______________________________________________
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> 

------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to