With the implementation of BI4, our company moved from producing .xls files to .xlsx files. All good and well, but that brings some unexpected consequences as well.
Every day, we produce some 80 reports, that get stored on a SharePoint Server. Every file has some custom properties in SharePoint, like a periodicity and a Group.
With .XLS files, this metadata gets stored on one place only : SharePoint. However, when you work with .XLSX files, you may run into some trouble -- because the Metadata is then stored INSIDE the document. Given the fact that some of the properties are custom, there is no way to update the metadata, until you have actually uploaded the document to SharePoint -- and if that file came from Business Objects, you just overwrote your Metadata with BLANKS.
This article will provide you with a work-around.
=========================
First some VBScript code:
Set oBook = oExcel.Workbooks.Open(objFile)
oBook.saveas strDestFolder & Replace(objFile.Name, "$", "\"), 51
oBook.ContentTypeProperties("Group").Value = sGroup
oBook.ContentTypeProperties("Period").Value = sPeriod
oBook.ContentTypeProperties("Description").Value = sDescription
oExcel.AutomationSecurity = 1
oBook.save
oBook.close
oExcel.quit
Before you implement this, you will be needing to write a script that will copy your Excel documents to SharePoint. If you need help with that part, probably the above code will do you little good.
It took me a good deal of time, to write the code above -- very happy with it. What I'm doing in the rest of the script is run through a text-file to locate the file I'm copying --and I store the current description and group in it.
The script above will then store that onto the SharePoint server, after saving the file to that location.
For you Powershell lovers:
$objFile = $objExcel.workbooks.open($OutFile)
$builtinProperties = $objFile.ContentTypeProperties
foreach($builtinProperty in $builtinProperties){
if ($builtinProperty.Name -eq "Description"){
$builtinProperty.value = $Description
}
if ($builtinProperty.Name -eq "Period"){
$builtinProperty.value = $Period
}
if ($builtinProperty.Name -eq "Group"){
if($group[1] -eq "B00"){
$builtinProperty.value = "Bank"
}
}
}
$objFile.Save()
I have no good PowerShell editor, so the above code took me even longer to put together.. it does the same as the vbscript.
So the workaround is basically : use VBScript to copy your Excel file to SharePoint. Open it with VBScript, read the metadata from a textfile.. and then, using the code above, to set the metadata.
I hope it helps you -- I'm pretty sure it will help me, if I ever need to figure this out again.
Peter
External memory from my trainings. I used to teach Business Objects, Internet Development and Hardware at Xylos NV (http://www.xylos.com)
donderdag, juli 14, 2016
dinsdag, juli 05, 2016
Of BI 4 and why you should always purge your queries.
Purge is an underused function.
I have explained this to my students. You should always purge your documents. It's easy to do, it's the right thing to do. But now that I have had some months of experience with BI 4, it's even more important.
BI4 will never be my best friend. The Toolbar is very poorly designed.
There are 3 functions EVERY user will use, EVERY time.
1) Refresh
2) Next Page
3) Save as Excel
This is the refresh button. If you cannot locate it .. it's the tiny little thing just to the left of the table icon and just to the right of the edit query button.
Here is my suggestion.. it's ugly, but even this one is better:
The same is valid for the next page and previous page buttons. They're tiny and away from everything else.. put them big and bold next to that refresh button.
And the Save to Excel button.. big and bold next to those.
And PLEASE .. PRETTY PLEASE.. get rid of the Tabbed design. It S***S. Either do it right, or don't do it at all. At least the tabbed design in MS Office makes some sense.
Mostly because it's possible to customize them and put the buttons you use regularly on one tab.
Get a hint from the menu structure from Desktop Intelligence and turn that into a tab-design.
But I'm getting a bit carried away here :)
The most important message I want to give : ALWAYS purge your document.
BI 4 has the nasty habit, of sending the result of the stored query, if refreshing didn't work out.
That's right ladies and gentlemen. You read it right. BI4 will occasionally just send you the result of the STORED data. Not the NEW DATA.
So, PURGE your document -- if your document comes back EMPTY -- you'll know that something went wrong. When the previously stored data comes back, it won't be so clear.
Sorry for the rant. But I thought it was important.
I have explained this to my students. You should always purge your documents. It's easy to do, it's the right thing to do. But now that I have had some months of experience with BI 4, it's even more important.
BI4 will never be my best friend. The Toolbar is very poorly designed.
There are 3 functions EVERY user will use, EVERY time.
1) Refresh
2) Next Page
3) Save as Excel
This is the refresh button. If you cannot locate it .. it's the tiny little thing just to the left of the table icon and just to the right of the edit query button.
Here is my suggestion.. it's ugly, but even this one is better:
The same is valid for the next page and previous page buttons. They're tiny and away from everything else.. put them big and bold next to that refresh button.
And the Save to Excel button.. big and bold next to those.
And PLEASE .. PRETTY PLEASE.. get rid of the Tabbed design. It S***S. Either do it right, or don't do it at all. At least the tabbed design in MS Office makes some sense.
Mostly because it's possible to customize them and put the buttons you use regularly on one tab.
Get a hint from the menu structure from Desktop Intelligence and turn that into a tab-design.
But I'm getting a bit carried away here :)
The most important message I want to give : ALWAYS purge your document.
BI 4 has the nasty habit, of sending the result of the stored query, if refreshing didn't work out.
That's right ladies and gentlemen. You read it right. BI4 will occasionally just send you the result of the STORED data. Not the NEW DATA.
So, PURGE your document -- if your document comes back EMPTY -- you'll know that something went wrong. When the previously stored data comes back, it won't be so clear.
Sorry for the rant. But I thought it was important.