Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Array not showing updated record
Message
De
21/06/2002 03:25:24
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00670174
Message ID:
00670929
Vues:
19
Nick,
I think what happens is this (as I understand v_id is key field) :
-Your next_id.prg is called as a default value in base table, not view.
-Your view doesn't mark v_id as updatable.
If that's the case you'd need either a requery or do the select from base table instead.

Alternatively you could mark v_id as updatable and in view properties add next_id() as default value.

PS: "Since I was using == to compare..."
You don't need alltrim() for 'H' with 'trailing' spaces in SQL.
When used in 'SQL' == operator takes care of it for you. ie:
lcValue1 = 'H'
lcValue2 = 'H                   ' && Many trailing spaces
select * from myTable where myField == lcValue1
select * from myTable where myField == lcValue2
select * from myTable where alltrim(myField) == alltrim(lcValue1)
select * from myTable where alltrim(myField) == alltrim(lcValue2)
Would mean the same.
IOW following return 'empty' fields in a Rushmore optimizable fashion :

select * from myTable where myField == ''

But note that this is valid for "SQL". SQL implies 'set ansi' where nonSQL commands use 'set exact' (implies might be wrong term - not sure:)
Cetin

>Thank you for answering. I'm sorry Cetin, I did mean
>
>
>Insert into lv_veh(v_no) value (alltrim(.txtv_no.value))
>
>
>However, I tried you example, and the array returned a 0 for v_id. v_id is an integer value that is primary key in my table. I know the record was wrote because a nextid.prg file assigns unique integer number everytime I insert into my table for v_id. I went through that code in during insert by using the debugger. The reason why I used alltrim was because
>
>
>.txtv_no.value had spaces like this 'H    '
>
>and
>
>lv_veh.v_id had spaces like this 'H '
>
>
>Since I was using == to compare, I though I should keep both sides same.
>I put the following statment after select into array to see what values was in the view
>
>
>select lv_veh.v_id FROM lv_veh WHERE ;
> ALLTRIM(lv_veh.v_no) == ALLTRIM(m.vno) into array a__gen2
>	mx = lv_veh.v_id
>	mz = lv_veh.v_no
>	mp = lv_veh.v_vin
>
>
>mx return 0 && which is incorrect should be 152
>mz return H && which is correct
>mp return H && which is correct
>
>Is there another way I can get the v_id value?
>
>Thanks
>Nick Patel
>
>
>
>>>If I insert a value into a view, then try to find the value from the view by selecting to an array, the value doesn't appear. The array returns back empty. I know the insert was successful because when I go and look at the table, the data is there. I'm I doing something wrong here?
>>>
>>>
>>>cursorsetprop('sendupdates', .T.,'lv_veh')	
>>>Insert into lv_veh(v_no) value (alltrim(.txtv_no))
>>>tableupdate(.t., .t., 'lv_veh')
>>>vno = alltrim(.txtV_no.value)
>>>select lv_veh.v_id FROM lv_veh WHERE ALLTRIM(lv_veh.v_no) == ALLTRIM(vno)   into array a__gen2
>>
>>>
>>>Thanks
>>>Nick Patel
>>
>>Nick,
>>There is .txtv_no and .txtv_no.value in code. Very rarely I saw you could have a property and object with same name but not even sure how to replicate.
>>
>>Would this work right ?
>>
>>
>>Insert into lv_veh(v_no) values (.txtv_no.value)
>>tableupdate(.t., .t., 'lv_veh')
>>vno = .txtV_no.value
>>select lv_veh.v_id ;
>>  FROM lv_veh ;
>>  WHERE lv_veh.v_no == m.vno ;
>>  into array a__gen2
>>if _Tally > 0
>> wait window 'Worked '+trans(a_gen2)
>>endif
>>PS: You don't need alltrim unless it's for left trimming.
>>Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform