Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Updating a view column that is an expression
Message
De
08/03/2018 11:58:56
Walter Meester
HoogkarspelPays-Bas
 
 
À
08/03/2018 11:30:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012 R2
Network:
Windows Server 2012 R2
Database:
Visual FoxPro
Application:
Desktop
Virtual environment:
VMWare
Divers
Thread ID:
01658618
Message ID:
01658622
Vues:
47
Hi Albert,

Yes this is the way to do it for plain VFP views.

Walter,



>Hi Dragan,
>
>It's not an SPT view but a plain-Jane VFP view - so I assume I issue you the cursorsetprop manually (have not used that command or dbsetprop much). I will probably do what you suggest but also wanted to just futz with this a bit more to understand what is happening (and to save reworking the existing code too much).
>
>So I noticed in the view designer that for the other non-encrypted fields, command like this are in the SQL setup when you click on "Show SQL":
>
>DBSetProp(ThisView+".banking_id","Field","DataType","N(5)")
>DBSetProp(ThisView+".banking_id","Field","UpdateName","banking.banking_id")
>DBSetProp(ThisView+".banking_id","Field","KeyField",.T.)
>DBSetProp(ThisView+".banking_id","Field","Updatable",.T.)
>
>so I thought I would just edit this code directly and put a set in for the Acct_Name field (the one to be decrypted as an expression).
>
>- turns out the view designer turns Updatable back to .F. (for some reason).
>- so then I thought I would issue this command outside of the view designer
>
>DBSETPROP("v_aatest.acct_name","field","updatable",.t.)
>
>- now when I open the view and edit it, it posts the changes back to the table.
>
>I don't know if this method is less work but it would certainly be a maintenance headache to have to remember to issue that command after changing the view (although I could always create the view programmatically as I have a few of those already where it is impossible to create the view in the view designer).
>
>Thoughts or something I am not seeing?
>
>Albert
>
>
>>It is not updatable but if it's a SPT view it's still readwrite. Now the difference is that this field doesn't have an underlying source table field into which the updates would be sent (hence not updatable, as in "doesn't update to source field") but I don't see why would it be read-only. And I think you can use the old trick to
>>
>>- do your decryption
>>- set the alias to not updatable (using cursorsetprop, or in a CA, .sedndupdates=.f.)
>>- tableupdate(), which will now do nothing but will reset the field states that you can check by getFldState() and which Fox uses internally to know which fields are dirty - so now it considers them all clean
>>- set the alias to updatable (again cursorsetprop or ca.sendupdates=.t.)
>>
>>Now you have records you can present to the user and you'll know which fields have changed after this point.
>>
>>(stole this from Walter, btw)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform