Get a Jumpstart with our Sample Apps
Results 1 to 2 of 2

Thread: Dynamically selected current DBF user data backup method

  1. #1
    "Certified" Alphaholic Ray in Capetown's Avatar
    Real Name
    Ray Hendler
    Join Date
    Jan 2009
    Location
    South Africa
    Posts
    2,036

    Default Dynamically selected current DBF user data backup method

    No pre-selection required, no forgetting to update with new and user unique tables, no out of sync memo files
    Just enter your backup zip folder and name and run. Any tables added or dropped will be in/ or ex/cluded.

    tin=0 ' FILE COUNT FOR PERCENTAGE DISPLAY
    while (tblname <> "")
    tin=tin+1
    tblname=:a5.Table_Enum(tblname,8)
    end while
    thiszip = "dr:\folders\backupname.zip"

    ii=0 'COUNT THROUGH ONLY REGISTERED TABLES IN CURRENT DB FOLDER
    progresspercent(1)
    tblname=:a5.Table_Enum("",8)
    while (tblname <> "")
    ii=ii+1
    if :a5.Get_Path()$tblname
    FILE.ZIP(thiszip,tblname)
    tbln=strtran(tblname,".dbf",".fpt")
    FILE.ZIP(thiszip,tbln)
    tbln=strtran(tblname,".dbf",".cdx")
    FILE.ZIP(thiszip,tbln)
    end if
    tblname=:a5.Table_Enum(tblname,8)
    progresspercent(ii/tin*100)
    end while
    progresspercent(100)
    Last edited by Ray in Capetown; 12-31-2016 at 10:11 AM.

  2. #2
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,211

    Default Re: Dynamically selected current DBF user data backup method

    Very handy Ray - so I tweaked it a bit and made it into a UDF back_adb_01082017.txt

    Code:
    FUNCTION back_adb AS C (vZip AS C = "")		
    'DESCRIPTION: Backup script by Ray Hendler converted to UDF by Robin Q	
    'can call from a button script and optionally use the return value to open the zip or copy the file to a usb stick
    	if vZip = "" then
    		'give the back up file the same name as the ADB with a date & Zip extension in current adb directory
    		vZip = strtran(a5.Get_Name(),".adb",chr(95)+cdate(date())+".zip")
    		'NOTE: May need to use HOME key to place cursor at beginning of file name when dialog opens
    		vZip = ui_get_file("Backup Zip File","Zip files (*.zip)",vZip)
    		if vZip = "" then
    			'user cancelled
    			end
    		end if
    	end if
    	
    	ii=0 'COUNT THROUGH ONLY REGISTERED TABLES IN CURRENT DB FOLDER
    	progresspercent(1)
    	tblname=:a5.Table_Enum("",8)
    	while (tblname <> "")
    	ii=ii+1
    	if :a5.Get_Path()$tblname
    	FILE.ZIP(vZip,tblname)
    	tbln=strtran(tblname,".dbf",".fpt")
    	FILE.ZIP(vZip,tbln)
    	tbln=strtran(tblname,".dbf",".cdx")
    	FILE.ZIP(vZip,tbln)
    	end if
    	tblname=:a5.Table_Enum(tblname,8)
    	progresspercent(ii/ii*100)
    	end while
    	progresspercent(100) 
    	back_adb = vZip
    END FUNCTION
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

Similar Threads

  1. Argument to print Current Records Selected in a Grid
    By forskare in forum Mobile & Browser Applications
    Replies: 1
    Last Post: 03-05-2015, 05:03 AM
  2. How do I navigate from Tab to Tab without losing pointer to current selected client?
    By Fulltimer in forum Application Server Version 11 - Web/Browser Applications
    Replies: 3
    Last Post: 09-06-2012, 01:26 PM
  3. Find and Use Current Logged In User Data?
    By Stupidscript in forum Application Server Version 10 - Web/Browser Applications
    Replies: 12
    Last Post: 02-09-2011, 11:16 AM
  4. Any method to backup data only?
    By victor_ikk in forum Alpha Five Version 6
    Replies: 5
    Last Post: 07-21-2005, 03:03 AM
  5. Copy current selected ?
    By Marc King - A5solutions in forum Alpha Five Version 5
    Replies: 5
    Last Post: 02-10-2004, 11:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •