Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP 5.0 Email program (please help)
Message
From
23/05/2001 11:59:41
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
23/05/2001 11:38:19
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00510400
Message ID:
00510420
Views:
15
>Hello All:
>
>What I am trying to accomplish and selecting all my required fields from my table, there are 18 columns\fields. Second, in vb you can use "CR+" to format the data to the next line how is this done in VFP?
>And Last, I would like to include the header name as well how can I do this?
>
>
> * Send the Recipient name and resolve.
>
> .RecipDisplayName = alltrim(faxmast.faxname)
> .RecipType = 1
> .ResolveName()
>
> .MsgSubject = ALLTRIM(faxmast.cscode)
> .MsgNoteText = ALLTRIM(faxmast.cscode)+space(1)+dtoc(faxmast.pkgid)
>&& Is there a better way to do this, I have 18 fields to bring in, also I need && a way to include the header like you would do in VB?
>
>.Send( .f. )
>endwith
>
>Thank you all very much in advance.
>
>PM
>
>"Keep coding!"

Paul,
There are multiple ways. I think writing to file and reading back would be a fast one :
function PrepareMsgNote
#define NL chr(13)+chr(10)
lnFields = fcount()
lcTempFileName = "X"+sys(2015)+".tmp"
handle = fcreate(lcTempFileName)  && Create a temp file
&& Write header line
FOR ix = 1 to lnFields
  =fwrite(handle, padr(field(ix),10)+':'+TypeConvert(ix)+NL)
ENDFOR
lnSize=fseek(handle,0,2)
=fseek(handle,0,0)
lcText = fread(handle, lnSize)  && Read file back
=fclose(handle)
ERASE (lcTempFileName)
RETURN lcText

FUNCTION TypeConvert && Convert VFP data types to char
LPARAMETERS tnField
lcType = type(field(ix))
luValue = iif(lcType='G','',eval(field(ix)))
DO case
  CASE lcType = "D"
    lcValue = dtoc(luValue)
  CASE lcType = "T"
    lcValue = ttoc(luValue)
  CASE lcType = "N"
    lcValue = padl(luValue,20," ")
  CASE lcType = "L"
    lcValue = iif(luValue,"Yes","No")
  CASE lcType $ "CM"
    lcValue = luValue
  OTHERWISE
    lcValue = ""
ENDCASE
RETURN alltrim(lcValue)
You could use it like :
.msgNoteText = PrepareMsgNote()
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
Previous
Reply
Map
View

Click here to load this message in the networking platform