This is so easy in excel... why the h these guys use this odata garbage, I will never know... but I am trying to do something very simple, in thought. Can someone help me write the odata routine that I can put into a Set Variable action?
Column: Filename = 123456-r1.pdf
I need to set two variables from this same basic filename structure.
Variable: PartNumber
Variable: Revision
Partnumber = 123456 (all of the numbers up to and not including the "-")
Revision = 1 (the one or two digit number between the "r" and the ".")
In excel, I would write:
(A1)=123456R-r5.pdf
(A2)=SEARCH(".pdf",A1) = 11
(A3)=SEARCH("r",A1,A2-3) = 9
PartNumber=LEFT(A1,A3-2) = 123456R
Revision = MID(A1,A3+1,A2-A3-1) = 5
It would likely take me two full days to figure out all of the syntax required to do this simple task. I beg for help from anyone that has some sympathy for my plight!
Thank you.
Solved! Go to Solution.
Ok, it took a bit less time than I expected. Lucky this time. Forunately, expression builder is more advanced than I thought. It is still cryptic as hell. I was blown away by the inability to do simple add/sub. Had to wrap add() or sub() around things to do that. wow... What saved me wsa the lastIndexOf function. The ability to search form the right made it much easier.
To find the last "r", I used Set Variabe "Find-r":
lastIndexOf(body('Get_file_metadata')?['Name'],'r')
To find the last ".", I used Set Variable "Find Dot":
lastIndexOf(body('Get_file_metadata')?['Name'],'.')
To get part number, I wrote:
substring(body('Get_file_metadata')?['Name'],0,add(variables('Find-r'),-1))
Toi get the revision number, I wrote:
substring(body('Get_file_metadata')?['Name'],add(variables('Find-r'),1),sub(sub(lastIndexOf(body('Get_file_metadata')?['Name'],'.'),lastIndexOf(body('Get_file_metadata')?['Name'],'r')),1))
Ok, it took a bit less time than I expected. Lucky this time. Forunately, expression builder is more advanced than I thought. It is still cryptic as hell. I was blown away by the inability to do simple add/sub. Had to wrap add() or sub() around things to do that. wow... What saved me wsa the lastIndexOf function. The ability to search form the right made it much easier.
To find the last "r", I used Set Variabe "Find-r":
lastIndexOf(body('Get_file_metadata')?['Name'],'r')
To find the last ".", I used Set Variable "Find Dot":
lastIndexOf(body('Get_file_metadata')?['Name'],'.')
To get part number, I wrote:
substring(body('Get_file_metadata')?['Name'],0,add(variables('Find-r'),-1))
Toi get the revision number, I wrote:
substring(body('Get_file_metadata')?['Name'],add(variables('Find-r'),1),sub(sub(lastIndexOf(body('Get_file_metadata')?['Name'],'.'),lastIndexOf(body('Get_file_metadata')?['Name'],'r')),1))
Nice solution... thank me very much!! 😄
Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!
Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.
User | Count |
---|---|
90 | |
50 | |
36 | |
30 | |
28 |
User | Count |
---|---|
74 | |
60 | |
50 | |
44 | |
38 |