QlikView – Open, Save, Close a QVW without reloading data using PowerShell

So you can open a QVW file from the command line with one of the following options

/r Reload, save, close.
/rp Partial-Reload, save, close.
/l Reload, leave open.
/p Partial-Reload, leave open.
/v Pass variable.

None of these options suited me, what I wanted was the following; Open QVW, immediately save it without doing anything i.e. not reloading data, not open script, nothing… then close the file. I was pointed towards the Automation Documentation over here http://community.qlikview.com/docs/DOC-1793 and I was provided with a macro that uses the COM Object in one QVW that opens, saves and closes another QVW. This solved the problem and could be called from the command line.

I didn’t like this solution as it was a bit hacky… Having one file call another etc etc, and I use PowerShell for the rest of my automation; I figured there has to be a PowerShell solution and came up with the following script:

function qv-SaveAndClose-QVW
{
 param(
  [Parameter(Mandatory=$true,ValueFromPipeline=$true)]
  $QvwPath
 )
 $qvComObject = new-object -comobject QlikTech.QlikView
 $NewDoc = $qvComObject.OpenDoc("$QvwPath")
 $NewDoc.Activate()
 $NewDoc.Save()
 $NewDoc.CloseDoc()
 $qvComObject.Quit()
}
Advertisements

SQLPackage and SSDT dropping and recreating items where they already exist and no changes were made

So I have been struggling for hours trying to figure out why my SQLPackage.exe task thinks it needs drop my Certificates even though I just deployed them and haven’t made any changes. Look at the example below, this is not the SSDT project or output it is only used for illustrating the problem and solution:

create certificate [YourCertificateName]
authorization [dbo]
with 
  subject = N'Some description about your encryption certificate'
  , start_date  = N'01/01/2012 00:00:00'
  , expiry_date = N'12/31/2050 00:00:00'
active for begin_dialog = on;

If you run this from SSDT or SQLPackage where you have the above Certificate scripted as part of a Database Project and deploy this more than once you will notice that it is dropping and recreating the Certificate every time. This happens without you making any changes and the object already existing. My colleague Simon Sabin point out the following “The reason for this is that the dates in the above script aren’t ISO Standard.” This means that if you run a Schema Comparison you will notice the Certificate on the server looks like this:

create certificate [YourCertificateName]
authorization [dbo]
with 
  subject = N'Some description about your encryption certificate'
  , start_date  = N'2012-01-01T00:00:00'
  , expiry_date = N'2050-12-31T00:00:00'
active for begin_dialog = on;

When a date is stored as a property or into a Date column it is converted to ISO standards and thus when you script an object using a different format they will look different even though they are the same and cause the object to be dropped and recreated.

T-SQL Code Documentor

I recently resigned and was tasked to document all the important stored procedure and triggers. Yes I know this should have been done at the time but we have never had time, or should I rather say it’s never been priority.

I was deliberating over the different methods possible to document the T-SQL code. Red-Gate has SQL Doc but that only updates extended properties. I thought I could use Word and document what every Stored Proc or Trigger does but that document will be dead in the water. When making changes some of this come to mind… “Oh I need to update the documentation”… “Where is the documentation saved again?”… “Aargh!!! The other guy did not document his changes”. The last two can be mitigated by using source control or versioned docs like Google Docs or Sharepoint etc. and a bit of discipline.

The worst part is, how do you tie sections of the code to sections of the document?

Then I thought I can document the code by adding standard T-SQL comments. This makes sense as the documentation then exists inside the code at the exact point where it matters or explains something; this is sometimes referred to as “Living Documentation”.Read More »

Go Directly To User Detail on SFDC

My wife works as a Salesforce Administrator. When Chatter launched she very quickly became annoyed with the new Chatter profile page that appeared when you clicked on a user’s name.

She wanted to go to the User Details page instead as this is where all the Admin gets done. She realised that to go to the User Details page all you needed to do was append noredirect=1 to the end of the Url.

I decided to develop a Chrome Extension to do this automatically for all User Profile links (i.e. Id’s that Start with 005).

https://chrome.google.com/webstore/detail/go-directly-to-user-detai/jpdmkhlcnjjndfpgljcpmllddeidkdjc?utm_source=eugeneniemand.com

Please feel free to download. If you have any feedback, bugs or suggestions please leave them on the Chrome Web Store.