For this requirement, please refer to my logic app below:
1. List all of the folders under /mycontainer/Invoice/
.
2. Initialize two variables in type of Integer, one named maxNum
and the other named numberFormatOfName
.
3. Use "For each" to loop the value
from "List blobs" above. In "For each" loop, first set numberFormatOfName
with expression int(replace(items('For_each')?['Name'], '/', ''))
. Then add a "If" condition to judge if numberFormatOfName
greater than maxNum
. If true, set the value of maxNum
with numberFormatOfName
.
4. After the "For each" loop, use another "List blobs" to list all of the blobs in latest(max number) folder. The expression in below screenshot is string(variables('maxNum'))
.
If you do not want list blobs, but you want get the blob content. You can do it like below:
==============================Update==============================
Running the logic app, I get the result shown as below screenshot:
I created three folders 20200101
, 20200202
, 20200303
under /mycontainer/Invoice
in my blob storage. The content of three csv file are 111,111
, 222,222
, 333,333
. The logic app response the third csv file content 333,333
.
=============================Update 2=============================