Thursday, February 02, 2012

How To: Swap Views/Tables Within the Same Database Using Crystal Reports 2008 Designer [Field Notes]

Background
I have a database with a few different views. They all return the same fields in copies of the same exact report, but those fields are calculated differently (hence the views).

The Problem
I wanted to be able to swap these views out without losing my fields, but couldn't seem to find a way to do it.

Crystal has a method for changing data sources, and for setting tables up to be overridden in this way, but there didn't seem to be any way to swap out a view that was already in the same database.

The Solution
NOTE: The solution below depends on the fact that your new tables or views should be returning the exact same fields (the new one can have additional fields, but not vice versa, which makes sense).

After some playing around, I figured it out. The best solution I've been able to come up with is:

  • While in your report, right-click on the Database Explorer and select Set Datasource Location.
  • In the bottom pane, select the datasource from your list as if it is a new datasource.
  • In the bottom pane, navigate to the table or view you'd like to replace.
  • In the top pane, click the table or view you'd like to replace.
  • In the bottom pane, click the table or view you'd like to replace the original table/view.
  • Click Update.
This will work, but it will appear to fail. That's because Crystal Reports keeps the same alias in its list of datasources. To double-check this, you can go select Show Query... from the Database menu and you'll be able to see that the SQL is just covering up your new data source with the old alias name.

This might be fine for some folks, but it drives me up a wall. To fix that issue and get the names back in sync:
  • Right-click on the database and select Database Explorer
  • In the panel on the right, right-click the improperly named datasource and select "Rename". 
  • Enter the name of the table or view it is currently pointing to.


At this point, you'll have successfully completed the swap, with all your report fields making it out alive.

Wednesday, February 01, 2012

January 31, 2012 [The Grocery List]

[A new tradition where I keep myself honest by posting the things I buy at the grocery store.]

Picked up from Giant:

  • 6 Apples
  • 1 spaghetti squash
  • Asiago cheese
  • Razors
  • Shower cleaner

Tuesday, January 31, 2012

Crafty, Google+. Very Crafty.

A quick observation: on most social networks (LinkedIn, Facebook, etc.) you'll see the option to connect with folks that you know.

Google+ applies this intuitive concept, but with a twist to its own benefit.

On the right-hand side of the Google+ home page, I noticed the option to add folks, and (wrongly) made the quick assumption that these folks are already on the network, despite the fact that some buttons are instead labeled "Add and Invite". Picture below:

Notice the difference? You might not at first glance.
It's not the end of the world or anything, but if G+ just duped me into inviting 10+ people unwittingly, it likely has gotten many more sign-ups this way.

A subtly shady tactic on Google's part. They might argue that they've streamlined the process, but to me, inviting someone actively to a social network (i.e. telling them they should join) is a much different vibe than adding them if they are already on the network.

I just made this mistake with a few former co-workers and friends I haven't connected with in a while (sorry if you got a weird invite, all!), so I wanted to make note of the design difference.

Makes me appreciate all the more that sites like LinkedIn make it clear with an icon who is a member and who isn't yet.