Subject Re: field update
From Ken Mayer <dbase@nospam.goldenstag.net>
Date Tue, 13 Feb 2018 11:40:15 -0800
Newsgroups dbase.getting-started

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