How did the record get created to begin with? Did it start with a
cm_patient_id value of 0? Are you sure you committed your change when using
the database management tool?
Anthony
On Friday, May 3, 2013 9:37:10 AM UTC-4, Tim Richardson wrote:
>
>
>
> On Friday, 3 May 2013 21:31:09 UTC+10, Anthony wrote:
>>
>> Are you saying you do or do not want cm_patient_id in the grid?
>
>
> cm_patient_id is not shown on the grid, which is correct.
>
> Sorry for the poor post, I am using fields like so:
>
> fields=[db_vciadmin.web_form_1te.date_submitted, ...
>
>
>
>
>> What do you mean when you say you "edit the table to put a value in
>> cm_patient_id"? How are you doing that (presumably not via the grid, given
>> that editable is False)?
>
>
> I meant that I am editing in directly via the database management tool (in
> this case MS SQL Management Studio) . I am doing this to try to understand
> what is going on.
>
> In the production app, the edit of cm_patient_id is done with an SQLFORM
> like so:
>
> def match_patient():
> row_id = request.vars.row_id
> #get the record
> web_form_record = db_vciadmin.web_form_1te[row_id]
> query = db_ps(db_ps.cm_patient.surname.contains(web_form_record.
> surname)) #this subsets the values sent to the dropbox
>
> db_vciadmin.web_form_1te.cm_patient_id.requires = \
> IS_IN_DB(query, 'cm_patient.id', '%(surname)s, %(first_name)s
> DOB: %(dob)s',zero=T('choose one'))
>
> form = SQLFORM(db_vciadmin.web_form_1te,record=web_form_record)
> .
> .
> .
>
> (match_patient is setup in the SQLFORM.grid using links= )
> So I am mucking around a bit with the requires definition in the model.
> However, the database value is reset in the controller which shows the
> grid. It is not reset simple because a new request occurs, as far as I can
> tell.
>
>
>>
>> Anthony
>>
>> On Friday, May 3, 2013 4:15:26 AM UTC-4, Tim Richardson wrote:
>>>
>>> I must have missed something.
>>>
>>> In 2.4.6
>>>
>>> I have a MSSQL table with an integer field. When I show the table with
>>> SQLFORM.grid, one of the fields is being reset to 0.
>>> The definition of this field is
>>> Field("cm_patient_id","integer")
>>> The table is migrate =False.
>>>
>>> the SQLFORM.grid is
>>> form = SQLFORM.grid(db_vciadmin.web_form_1te,deletable=False,
>>> user_signature=False,editable=False,Field=[...]
>>>
>>>
>>> but cm_patient_id is not one of the fields in the Field.
>>> If I edit the table to put a value in cm_patient_id, I see that when the
>>> SQLFORM.grid controller executes, cm_patient_id is reset to zero.
>>> Driving me crazy. Seems a bit odd, and certainly unexpected.
>>>
>>>
>>>
>>>
>>>
>>>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.