Subject Re: field update
From Mustansir Ghor <mustan31@hotmail.com>
Date Wed, 14 Feb 2018 01:47:29 -0500
Newsgroups dbase.getting-started

Dear Ken Sir

Thank you sir.

However since mitem is a memory variable for the field it would has considered as displayed value.  But in actual, it did not assigned anything and field remained blank. Or is it that assignment value would change data in the lookuprowset field.

Best Regards
Mustansir



Ken Mayer Wrote:

> On 2/13/2018 10:26 AM, Mustansir Ghor wrote:
> > Dear All
> >
> > I have a command below but is fails to update the fields code (mitem has code value). Can this be because code field is link with lookupSQL.
> >
> > form.register.rowset.fileds["code"].value = mitem
> > form.register.rowset.save()
> >
> > Can anybody help on this.
>
> If you're using a lookupSQL for the field, then you need to assign the
> value that is being displayed. It's a little tricky, you're doing a
> weird bit here where what is being seen by the software on one side are
> the values you are telling it to display from the lookupSQL, and when
> you select an item from a list, or assign a value, it has to be the
> *displayed* value, not the underlying code ...
>
> If you need to assign the code instead, then you need to turn off the
> lookupSQL:
>
> cLookup = form.register.rowset.fields["code"].lookupSQL
> form.register.rowset.fields["code"].lookupSQL = null
> form.register.rowset.fields["code"].value = mitem
> form.register.rowset.save()
> form.register.rowset.fields["code"].lookupSQL := cLookup
>
> However, it is easier to assign the displayed value if you can. Then you
> don't need all the code I just posted.
>
> Ken
>
> --
> *Ken Mayer*
> Ken's dBASE Page: http://www.goldenstag.net/dbase
> The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
> dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
> dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm