Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
|First|,|Name|
"First"|"Name"
Append From (filename) SDF With Character "|"
DELIMITED is for files that contain data with delimiters and separators. There's a lot of confusion about those two, particularly since the command itself mixes them up. Delimiters are characters that surround the data in a field. For example, the word "snazzlefritz" is delimited by quote marks in this sentence. Separators come between two data items. For example, the following list of colors uses commas as separators: "chartreuse, lavender, fuchsia, taupe, teal." A delimited file normally contains both delimiters and separators. Here's an example (generated from the Labels.DBF that comes with VFP):
"DATAW","LABELLYT","Avery 4143",F,4869,/ /
"DATAW","LABELLYT","Avery 4144",F,39266,/ /
"DATAW","LABELLYT","Avery 4145",F,24620,/ /
"DATAW","LABELLYT","Avery 4146",F,32961,/ /
Each character field is surrounded by quotes (the delimiters), and fields are separated by commas. This is the default format for a delimited file.
TYPE DELIMITED can handle several other options. DELIMITED WITH BLANK and DELIMITED WITH TAB use quotes for delimiters, and fields are separated by spaces or tabs. DELIMITED WITH DELIMITER lets you specify the delimiter—fields are separated by commas.
VFP 5 introduced the DELIMITED WITH CHARACTER clause that lets you specify the separator. So DELIMITED WITH CHARACTER ! means that there's an exclamation point between each pair of fields. We can't see why they couldn't have improved the situation here by giving this option a useful name like SEPARATED BY. Nonetheless, we're very grateful to have this option because it increases the number of files we can handle without having to break out the low-level file functions.
You can combine DELIMITED WITH and DELIMITED WITH CHARACTER to specify both the delimiter and the separator.
Append From (filename) Delimited With ["] Delimited With Character [|]
APPEND FROM (lcFile) DELIMITED WITH " WITH CHARACTER |
APPEND FROM mytxt.txt DELIMITED WITH _ WITH CHARACTER *
thisform.olecontrol1.UnlockComponent("70XZT-6V87E-SMFLB-0N56G-5Y0RH-L6QM6-MK7L4")
thisform.olecontrol1.username=ALLTRIM(thisform.text1.Value)
thisform.olecontrol1.password=ALLTRIM(thisform.text2.Value)
nCon=thisform.olecontrol1.connect()
IF nCon=1
WAIT WINDOW "Connected to D&H FTP. Downloading Items." TIMEOUT 2
thisform.olecontrol1.getfile("ITEMLIST",cPath+"ITEMLIST")
*this.Parent.olecontrol1.asyncgetfilestart("ITEMLIST","ITEMLIST")
thisform.olecontrol1.disconnect()
USE cPath+"dhitems.db"
APPEND FROM cPath+"ITEMLIST" Delimited With Character |
nRecs=RECCOUNT()
FOR x=1 TO nRecs
USE cPath+"dhitems.db"
GOTO x
WAIT WINDOW "Processing Record "+TRANSFORM(x)+" of "+TRANSFORM(nRecs) nowait
nSku=dhitems.mfno
nBarcode=dhitems.barcode
nLong=dhitems.long
nShort=dhitems.short
nCost=dhitems.cost
USE cPath+"inventory.db"
GO BOTTOM
APPEND BLANK
replace inventory.sku WITH nSku,;
inventory.barcode WITH nBarcode,;
inventory.longdesc WITH nLong,;
inventory.shortdesc WITH nShort,;
inventory.cost WITH nCost
ENDFOR
MESSAGEBOX("All D&H Inventory Has been imported!",64,"ShftPOS")
ELSE
MESSAGEBOX("Unable to connect to D&H Distributing FTP. Please verify that your username and password are correct!",48,"ShftPOS")
ENDIF
thisform.olecontrol1.UnlockComponent("70XZT-6V87E-SMFLB-0N56G-5Y0RH-L6QM6-MK7L4")
thisform.olecontrol1.username=ALLTRIM(thisform.text1.Value)
thisform.olecontrol1.password=ALLTRIM(thisform.text2.Value)
nCon=thisform.olecontrol1.connect()
IF nCon=1
[indent]WAIT WINDOW "Connected to D&H FTP. Downloading Items." TIMEOUT 2
thisform.olecontrol1.getfile("ITEMLIST",cPath+"ITEMLIST")
*this.Parent.olecontrol1.asyncgetfilestart("ITEMLIST","ITEMLIST")
thisform.olecontrol1.disconnect()
USE cPath+"dhitems.db" ORDER TheIndex ALIAS TblItems in 0
APPEND FROM cPath+"ITEMLIST" Delimited With Character |
USE cPath+"inventory.db" ORDER TheIndex ALIAS TblInventory IN 0
SELECT TblItems
[indent]SCAN
WAIT WINDOW "Processing Record "+TRANSFORM(RecNo())+" of "+TRANSFORM(Reccount()) nowait
nSku=TblItems.mfno
...
SELECT TblInventory
APPEND BLANK
replace TblInventory.sku WITH nSku,;
...
SELECT TblItems
ENDSCAN[/indent][/indent]
MESSAGEBOX("All D&H Inventory Has been imported!",64,"ShftPOS")
ELSE
MESSAGEBOX("Unable to connect to D&H Distributing FTP. Please verify that your username and password are correct!",48,"ShftPOS")
ENDIF
SCAN
WAIT WINDOW "Processing Record "+TRANSFORM(RecNo())+" of "+TRANSFORM(Reccount()) nowait
APPEND BLANK IN TblInventory
REPLACE IN TblInventory ;
TblInventory.sku WITH TblItems.sku, ;
TblInventory.xxx WITH TblItems.xxx
...
ENDSCAN