Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Offline Views
Message
 
To
23/04/1999 08:59:12
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00210083
Message ID:
00211466
Views:
24
Cetin,

It seems to me that your problem is really related to the remote view, not to the fact that you've taken it off line. What is the back end for the view (VFP, SQL Server, Access)? I've found that in many cases back ends can't accept empty fields for certain types. What I do is very similar to what you're doing except that I put a null in the field if it's empty. Like this:
for ix = 1 to fcount()
  if empty(eval(field(ix))) and type(field(ix)) $ "MDT"
    REPLACE (field(ix)) WITH NULL
  endif
endfor
>Hi again Josh,
>Better a sample code what I mean. Bolded parts could make you follow easier. I suspect what I do wrong is in the way I set my remoteview (BTW I was trying to talk about remote views - local shouldn't have this problem) :
* Local database with remote view emp_view_remote - testdata!employee here
>* All fields updatable except Photo - general (I couldn't include it:()
>
>llOffline = createoffline("emp_view_remote","d:\temp\mydata")  && Create offline
>if !llOffline
> messagebox("Couldn't created offline")
>endif
>set multilocks on
>set exclusive off
>use ("emp_view_remote")
>
>3 && Go to a random record
>scatter memvar memo
>m.emp_id = str(recco()+1,3)
>insert into ("emp_view_remote") from memvar && Newrec for lazy tester :)
>=newrec() && Create a new empty rec
>=newrec()
>
>browse && Make edits and adds
>use  && Close it
>
>
>* Reconnect to the host and open the view.
>USE emp_view_remote ONLINE EXCLUSIVE  && Get online
>
>if  !tableupdate(1,.f.,"emp_view_remote")
> lnErrElems = aerror(aErrors)
> for ix = 1 to 6
>  ? aErrors[ix]
> endfor
> wait "Errors listed for rec : "+str(recno("emp_view_remote"),5)
>endif
>use
>dropoffline("emp_view_remote")
>
>
>function newrec
>scatter memvar memo blank && New empty record w/o nulls
>
>* Normally this check is a matter just before tableupdate()
>* fill in for test
>for ix = 1 to fcount()
> if type(field(ix)) = "M"
>    store " " to ("m."+field(ix))
><B>* Prevent null + invalid string length for ODBC driver
>* Whenever I left memo in a new rec empty I get "Invalid string length"
> endif
> if type(field(ix)) $ "D"
>    store {1/1/100} to ("m."+field(ix)) && Prevent datatype mismatch for date
> endif
> if type(field(ix)) $ "T"
>    store dtot({1/1/100}) to ("m."+field(ix)) && Prevent datatype mismatch for datetime</B>
> endif
>endfor
>m.emp_id = str(recco()+1,3)
>
>insert into ("emp_view_remote") from memvar
I wonder should I really do this type of check. TIA.
>Cetin
>
>
>>Cetin,
>>
>>I'm not sure I understand your question. In my application I update all field types the same way as I would using tables directly. Could you give me a little more information on what you're trying to do?
>>
>>
>>>Hi Josh,
>>>In my very early days in VFP I wasn't aware of offline views and created a routine mixing xBase approach with DBC's. Now I use offline views too. Yet there are few problems I couldn't find a workaround :
>>>-Memo fields in newly added records (how to update them if blank)
>>>-General fields (embedded)
>>>-Date(time) fields (how to update them if blank)
>>>Do you have any idea ? TIA
>>>Cetin
>>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform