Delete file

Delete a file with the given file ID from Google Drive

Delete one file called given file

fileId

Possible use cases

  • Archive files at project end

Configuration

Click on the bold text in the title of the building block to open the configuration dialog.

The file id passed to the Delete file building block will be deleted. No further configuration required.

Useful combinations

You can either click on the keyboard icon to generate a form where you can enter the file id manually - or you can use the Find file building block to search for a file by name and retrieve the file id.

Complex reports

This example does show how to delete all obsolete files within a folder only skipping a template document.

It also shows a more detailed example of how to load worksheets containing data, extract specific information and separating them into individual reports. The example loads a revenue sheet where revenue data for all branches is maintained and separates this into individual reports for each branch of the current month.

List old files

Drive folder
del[].fileId
del[].file-name

For each file repeat (1 block)

del[].fileId
fileId
del[].file-name
fileName

Using the List Files building block all obsolete files in the reporting folder are selected. A Repeat building block combined with the Delete File building block deletes all files.

The skipping condition "${filename}" != "template" on the Delete File building block ensures a template file not to be deleted.

Delete file skip if template

fileId
Delete file

Repeat: Continue with next item

Load branch list

Branch list
brList[].branch

For each branch repeat (13 blocks)

brList[].branch
branch

As a report for each branch should be created a list of all available branches is loaded. For each branch a report is created.

From the worksheet containing all revenue data the branch relevant entries are loaded using a branch= query in the Load worksheet building block .

The Calculate columns building block converts the dates given in the revenue sheet into the correct format. Here a Form provides the relevant string/date conversion rules:

row.mydate = row.date.substring(6,10)+"-"+row.date.substring(3,5)+"-"+row.date.substring(0,2);

row.mymonth = parseInt(row.date.substring(3,5));

With the Filer rows building block all revenue entries of the current month are selected. The referring filter on the revenue table is row.mymonth == 1.

As the branch report is created newly every time the Ultradox file is executed (and the old files were deleted in the first step) the branch report template is selected with the Find file building block followed by a Copy files.

After the relevant rows were filtered the rows referring to the current branch are inserted into the branch specific report. In this example they just show date and revenue but of course more information can be added depending on the available data.

In a last step the Aggregate rows building block is used to calculate the current monthly revenue sum. In the form a variable for the monthly total is initialized result.total = 0; and the aggregation rule result.total += parseFloat(row.revenue); sums up the selected revenue items allowing them to be inserted as a summary row.

Load revenue sheet with ${branch} query

Revenue sheet
revenue[].branch
revenue[].date
revenue[].revenue

Convert date form

myDateExpression
myMonthExpression

Calculate columns

revenue[].date
myDateExpression
revenue[].myDate
myMonthExpression
revenue[].myMonth

Filter rows of current month

myMonthFilter

Filter rows

revenue[].date
Filtered Revenue
myMonthFilter

Find report template

Report template
templateId

Copy report template

templateId
branchReport
branch

For each filtered revenue item

filteredRevenue[].date
date
filteredRevenue[].revenue
revenue

Insert row in branch report

date
branchReport
revenue

Repeat: Continue with next item

Aggregation rule

aggregateRule

Aggregate rows

filteredRevenue[].revenue
branchSum
aggregateRule

Add sum row to branch report

branchSum
branchReport

Repeat: Continue with next item

Copy App

Questions and Feedback

If you have any comments on this page, feel free to add suggestions right to the Google document that we are using to create this site.

If you are not yet member of the Ultradox community on Google+, please join now to get updates from our end or to provide feedback, bug reports or discuss with other users.

Last Updated: 11/30/18