Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
HennSarv
Helper I
Helper I

Optional options as nullable record

Hi PowerQuery people,

 

Could You give me ANY hint where to find some reference for options?

Several functions have subject like parameter - for example Folder.Files

Only I find from docs or search is the fact that there is options or samples WITHOUT those options

But where to find FULL conent of those options

I suppose that Folder.Files is capable to traverse search all subfolders or generate list of subfolders but Only I can do is simply guess?

Any usefully reference is welcome
Henn

PS! Is theree any function (or any FUTURE function) to evaluate Environment or CURRENT PATH for file

 

1 ACCEPTED SOLUTION
mahoneypat
Employee
Employee

You can get a little more info by using #shared as your source in a blank query.  Convert that to a table and then filter to and click on the function of interest.  In the case of Folder.Files(), the optional parameter is "PreserveLastAccessTimes" and accepts true or false.

 

Here is the query I used to get to this function, if you want to see for yourself.

 

let
Source = #shared,
#"Converted to Table" = Record.ToTable(Source),
#"Filtered Rows" = Table.SelectRows(#"Converted to Table", each ([Name] = "Folder.Contents" or [Name] = "Folder.Files")),
Value = #"Filtered Rows"{1}[Value]
in
Value

 

 

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

5 REPLIES 5
HennSarv
Helper I
Helper I

SOmething I tried to create
Better to have some kind of option to allow include subdirs content
something like -Recurse in powershell Get-ChildItem have

(path as text) as table =>
let
Source = Folder.Contents(path),
// Source{[Name="Aiseesoft Studio"]}[Attributes][Directory]
Folders = Table.SelectRows(Source, each ([Attributes][Directory] = true)),

Step1 = Table.SelectColumns(Folders,{"Name", "Folder Path"}),
Step2 = Table.AddColumn(Step1, "DirContent", each DirContent([Folder Path]& [Name])),
Step3 = Table.RemoveColumns(Step2,{"Folder Path", "Name"}),
Expanded = Table.ExpandTableColumn(Step3, "DirContent", {"Content", "Name", "Extension", "Date accessed", "Date modified", "Date created", "Attributes", "Folder Path"}, {"Content", "Name", "Extension", "Date accessed", "Date modified", "Date created", "Attributes", "Folder Path"}),

Files = Table.SelectRows(Source, each ([Attributes][Directory] = false)),
Result = Table.Combine({Files,Expanded})
in
Result

HennSarv
Helper I
Helper I

Thänks - this #shared know (form past) - I forget that #shared show a bit more about options (no reference but some hint). As I understand - only option there is to preserve LastAccess untouched

 

NO option to traverse CONTENT of subfolders so for this I have to create some recursive function (is that possible with powerquery) to get content of folder appended contents from all subfolders 

v-juanli-msft
Community Support
Community Support

Hi @HennSarv 

Thanks to mahoneypat's suggestion,

As for get folders and its sub folders, you could refer to the following:

https://radacad.com/get-the-list-of-folders-only-in-power-bi-using-power-query

 

Best regards

Maggie

mahoneypat
Employee
Employee

You can get a little more info by using #shared as your source in a blank query.  Convert that to a table and then filter to and click on the function of interest.  In the case of Folder.Files(), the optional parameter is "PreserveLastAccessTimes" and accepts true or false.

 

Here is the query I used to get to this function, if you want to see for yourself.

 

let
Source = #shared,
#"Converted to Table" = Record.ToTable(Source),
#"Filtered Rows" = Table.SelectRows(#"Converted to Table", each ([Name] = "Folder.Contents" or [Name] = "Folder.Files")),
Value = #"Filtered Rows"{1}[Value]
in
Value

 

 

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Thanksa lot for help

 

this #shared thing I never reached. Somewhere documented? Something more hidden : )

 

Henn

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors