Article File Folder Path

Hey Community.

First of all, iam very happy for your support in the past.

I have the following question:

I create an app, where i can add article with there infos for our stock system. Everything works well and i want to create an google drive folder, for every article, i add in the app. i configure it, that appsheet create an pdf with every article information and save it in the right path. appsheet creates the non existing folder article, a subfolder for every article and the pdf with the right name and right infos and write the link back in my database, for opening it in the app, as an action i set.

May problem now:

I have no idea, how to tell appsheet, that the subfolder inside the article folder, should named by the article number from the new article.

I tryed it with "/Artikel/[Artikelnummer]/" in the file folder path, inside the process, but appsheet write back the folder name [Artikelnummer], but it should be 99999, if the articlenumber is 99999.

It would be very great if someone can tell me, how to write it right.

Many many thanks in advance for every help and answer.

Nice greets from Austria

Solved Solved
0 12 1,890
1 ACCEPTED SOLUTION

ok, i got it.

i try to explain how it works and i hope someone could have a usage for that.

I have a stock system and every product has his own documents. if iam or my employees needs documents from a specified article, the should click one action and got opened the right drive folder with the documents from this articel.

Sounds simple, it isnt.

Cause the only way to open a drive folder, is to get the unique drive folder html adress.

First, i start with an bot, that create a pdf document, for every new article, with ISBLANK([Drive Link])

the pdf is a simple template with the data i add by creating a new article.

This pdf is saved into an folder, namend with the article number, inside the folder article.

so i got a folder with the articlenumber, for every new article i add.

To get the link, to this folder, you have to add the folder ARTICLE to a table. Click on add table, google drive and select colletion of files. choose the folder ARTICLE (within all the folders named with the articlenumber) and add this. i decide to choose the name Article Data

If you have added the table, go to the table columns of ARTICLE DATA and click on show button from the _ID Column. 

Rename the column File to Articlenumber and set the typ to ref. Choose as source table, your ARTICLE table.

Create a virtual Column with the name Folder Link and as Text type. 

Insert this Formula inside this Column:

Concatenate("https://drive.google.com/drive/folders/",[_ID],"?usp=sharing")

you can see, that google give us the right ID to the folder, cause if you manualy go to the google drive folder and click on getting link, you see, if you check this link, its the same id inside. we only have to put the text bevor and after with the id together and we have the html link.

to link these folder link with your article table, you only have to make a virtual column in the article table, like VDrive Link and put this formula inside:

Lookup([_THISROW].[Artikelnummer],"Artikel Dateien","Artikelnummer","Folder Link")

so i want to open it with an symbol in my article detail view, as set as card type.

i create an action calles DRIVE LINK for the record of the table article, to do this: external: go to a website, and set as target the column VDrive Link.

Finish.

After you create a new article, appsheet create the folder, import the folder link and after about 10 seconds, you can click on the action and appsheet open your drive folder.

 

hope it helps

View solution in original post

12 REPLIES 12

You need to use an expression just like you do elsewhere in the app.  For your folder path use:

"/Artikel/" & [Artikelnummer] & "/" 

OR

CONCATENATE("/Artikel/", [Artikelnummer], "/") 

 

@WillowMobileSys 

i thought it would be easy ^^

many many thanks for your help, it works perfect!

Only one problem i got and i tought it is also the error in writing the code is, that appsheet create a wrong link to the folder. I Create a "run a data action" inside the bot, select "change row values", select the column: "Drive Link" and put these formula inside:

Concatenate("/appsheet/data/Artikelstamm-6548530/Artikel/",[Artikelnummer])

Can you tell me whats not right with this?

Many many thanks in advance

If you are using a google sheet as the datasource, AppSheet uses "relative pathing" based on the location of the sheet.  The sheet location is established as the "root", so all you need to supply is the relative path.  Which I assume is:

Concatenate("Artikel/",[Artikelnummer])

If you are using a database,  then AppSheet uses the default app path setting as the "root".   And again, based on what you have supplied, the File path would be the same as above.

you are right, i using a google sheet as database, and the created folder is stored at the root directory: root/appsheet/data/artikelstamm-6548530/Artikel/999999999

i tryed to change the formula to yours:

Concatenate("Artikel/",[Artikelnummer])
the column type is set to file and the image file/folderpath is set to:

"beka/Artikel//โ€&[Artikelnummer]

after i try to open it with my app sheet action, i got the following error: (also if i delete the path and leave it blank)

'Artikel/999999999' not found
Probable cause: N/A
Path: Root
Result: FAILURE
Message: N/A
Path: Root
Result: FAILURE
Message: N/A
Path: Root
Result: Success
Path: Root
Result: FAILURE
Message: N/A
Path: Root
Result: FAILURE
Message: N/A
Path: Root
Result: FAILURE
Message: N/A, Searching for 'Artikel', File entry not found
Path: Root
Result: FAILURE
Message: N/A, Searching for '999999999', File entry not found


@Michael_at_Graz wrote:

the column type is set to file and the image file/folderpath is set to:

"beka/Artikel//โ€&[Artikelnummer]


Remove the folderpath setting in the File column.  That is only needed for manual uploading of files and it would need to be the same as that configured in the automation if you did allow manual uploads.

What is saved to the Google sheet File column for File you are trying to open?

It should be something like "Artikel/999999999/filename.pdf"

 

Thanks, thats also my intensio and i removed the Column folder/file- path.

in the sheet, google sheets saved the following into the column:

Artikel/999999999

But maybe its an other problem:

The appsheet-app used data from an spreadsheet, is saved in an other folder, as the appsheet folder and in the appsheet setting, info/properties/default app folder, the folder from the app is saved:

/appsheet/data/Artikelstamm-6548530

i think there is no way to open a folder without an html link.

https://www.googlecloudcommunity.com/gc/AppSheet-Q-A/Open-a-Google-Drive-location/m-p/236434/thread-...

maybe i try to let appsheet add all folders as a table and let appsheet automatik sort the documents to the right articel.

You can add a Google folder to the app as a table following these steps:

1) In the Tables section, tap the "New Table" button.

2) Select the "add data from..." option.

Screen Shot 2022-10-13 at 3.22.55 PM.png

3) Select the "Google Drive Documents" option.

Screen Shot 2022-10-13 at 3.24.14 PM.png

4) Select the "Folder" option.

Screen Shot 2022-10-13 at 3.25.16 PM.png

5) Navigate to and select the Folder you wish to add as a table.

6)  Specify the AppSheet table name and then tap the "Create Table" button

Screen Shot 2022-10-13 at 3.27.37 PM.png

 

You now will have a table in your app that will list your documents/files as table rows.  Any new documents/files added to the folder will automatically be pushed the app (it does take a few minutes).  If you delete a row from the table, the document will be removed from the Google folder.

You can also add Virtual Columns to the AppSheet table.  In one of my apps I add to the filename the Inspection ID that a report is being generated for.  In this appSheet table, I have a Virtual Column for [Inspection] and extract the Inspection ID from the filename.

In my opinion, this is the best way to manage the generated documents in your app.

Try this way.

 "/Artikel/" & [Artikelnummer] & "/" 

Regards 

ok, i got it.

i try to explain how it works and i hope someone could have a usage for that.

I have a stock system and every product has his own documents. if iam or my employees needs documents from a specified article, the should click one action and got opened the right drive folder with the documents from this articel.

Sounds simple, it isnt.

Cause the only way to open a drive folder, is to get the unique drive folder html adress.

First, i start with an bot, that create a pdf document, for every new article, with ISBLANK([Drive Link])

the pdf is a simple template with the data i add by creating a new article.

This pdf is saved into an folder, namend with the article number, inside the folder article.

so i got a folder with the articlenumber, for every new article i add.

To get the link, to this folder, you have to add the folder ARTICLE to a table. Click on add table, google drive and select colletion of files. choose the folder ARTICLE (within all the folders named with the articlenumber) and add this. i decide to choose the name Article Data

If you have added the table, go to the table columns of ARTICLE DATA and click on show button from the _ID Column. 

Rename the column File to Articlenumber and set the typ to ref. Choose as source table, your ARTICLE table.

Create a virtual Column with the name Folder Link and as Text type. 

Insert this Formula inside this Column:

Concatenate("https://drive.google.com/drive/folders/",[_ID],"?usp=sharing")

you can see, that google give us the right ID to the folder, cause if you manualy go to the google drive folder and click on getting link, you see, if you check this link, its the same id inside. we only have to put the text bevor and after with the id together and we have the html link.

to link these folder link with your article table, you only have to make a virtual column in the article table, like VDrive Link and put this formula inside:

Lookup([_THISROW].[Artikelnummer],"Artikel Dateien","Artikelnummer","Folder Link")

so i want to open it with an symbol in my article detail view, as set as card type.

i create an action calles DRIVE LINK for the record of the table article, to do this: external: go to a website, and set as target the column VDrive Link.

Finish.

After you create a new article, appsheet create the folder, import the folder link and after about 10 seconds, you can click on the action and appsheet open your drive folder.

 

hope it helps

Aurelien
Google Developer Expert
Google Developer Expert

Hi @Michael_at_Graz 

Thank you for sharing the last post. Can you tag it as a solution ? So that users may find it more easily ๐Ÿ™‚

Top Labels in this Space