That's pretty good, although it doesn't solve the DataToClip() issue,
as I indicate earlier.
Your process issues a REPLACE for each varchar field in the cursor.
You might speed it up a bit, especially on large disc-bound datasets
with many varchars, by concatenating all of the REPLACEs into one
command:
LOCAL ARRAY laCols[1,18]
LOCAL n As Integer, i As Integer, lcFld As String, lcCommand AS String
n = AFIELDS(laCols,tcCursor)
lcCommand = "REPLACE ALL "
FOR i = 1 TO n
IF laCols[i,2] == "V"
lcFld = laCols[i,1]
lcCommand = lcCommand + "("+lcFld+") WITH ALLTRIM(EVALUATE("+lcFld+")),"
ENDIF
ENDFOR
if len(lcCommand) > len("REPLACE ALL ")
lcCommand = left(lcCommand,len(lcCommand)-1) && drop last comma
&lcCommand
endif
ENDFUNC && CTOV
On Wed, Jul 15, 2015 at 7:39 AM, Laurie Alvey <[email protected]> wrote:
> I have this function to TRIM all varchar fields in a cursor:
>
> FUNCTION CTOV(tcCursor As String) As VOID
> *********************************************************************************************************************************
> * Date : 19/06/2014, 11:13:27
> * Author : Laurie Alvey
> * Description: Replace all varchar columns with their TRIMmed contents
> * Parameters : Name of the open cursor on which to operate. -
> *
> *********************************************************************************************************************************
> LOCAL ARRAY laCols[1,18]
> LOCAL n As Integer, i As Integer, lcFld As String
> n = AFIELDS(laCols,tcCursor)
> FOR i = 1 TO n
> IF laCols[i,2] == "V"
> lcFld = laCols[i,1]
> REPLACE (lcFld) WITH ALLTRIM(EVALUATE(lcFld)) ALL
> ENDIF
> ENDFOR
> ENDFUNC && CTOV
>
> Laurie
>
>
> On 14 July 2015 at 12:31, Peter Cushing <[email protected]>
> wrote:
>
>> On 13/07/2015 18:09, Ted Roche wrote:
>>
>>> I thought about the TESTMERGE solution, and I do use that in some
>>> parts of the app, where the client has to interface with some
>>> dedicated hardware that has *WEIRD* formatting rules, but hadn't
>>> considered that here. If I can get away with Tracy's solution of
>>> hacking at _ClipText, I'll probably stick with it.
>>>
>>> You could always import the data with wide fields, calculate the maximum
>> widths, then create a custom cursor and import again.
>>
>> Peter
>>
>>
>>
>>
>>
>> This communication is intended for the person or organisation to whom it
>> is addressed. The contents are confidential and may be protected in law.
>> Unauthorised use, copying or disclosure of any of it may be unlawful. If
>> you have received this message in error, please notify us immediately by
>> telephone or email.
>> www.whisperingsmith.com
>>
>> Whispering Smith Ltd Head Office:61 Great Ducie Street, Manchester M3 1RR.
>> Tel:0161 831 3700 Fax:0161 831 3715
>> London Office:17-19 Foley Street, London W1W 6DW Tel:0207 299 7960
>>
>>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/CACW6n4v-OjHmE97NoTJOD2BSMkfsPd45+HNrO5BC=nRdUo0d=w...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.