Moving from PowerBuilder to Silverlight 4 – The Retrieval Argument


Similarities to PB Retrieval Arguments when using Silverlight 4 & WCF RIA Services

This is for PowerBuilder developers who are learning Silverlight 4.  If you are simply looking to learn how to pass a value to a query and limit the result set in Silverlight 4 then skip to “Using Silverlight 4 – Arguments”.

The datawindow is something very unique to PowerBuilder and the retrieval argument is specific to the datawindow, or datawindow object to be exact.  There is no cut equivalent of PowerBuilder retrieval arguments in Silverlight 4 however there are similarities.  This particular example relates to WCF RIA Services and also mildly relates to the MVVM architecture.

Using Retrieval Arguments in Powerbuilder

  1. Get/Set the argument value at the point prior to query.
  2. Code the datawindow.Retrieve() function passing arguments in place of retrieval arguments.
  3. SQL in dataobject gets dynamically replaced with arguments passed via the Retrieve function.

Using Silverlight 4 – Arguments


Step 1 – Get the ID and Open Detail Window

Silverlight 4 - PowerBuilder Retrieval ArgumentThe first step get your value and pass to detail window or section of code prior to your actual query.   The NavigationService is used to open a Silverlight 4 window with a free form entry grid used for editing one record. The eventId field had been set in a previous event and contains the eventId for the highlighted row.

NavigationService.Navigate( new Uri( "/EditEvent?EventID=" + eventId, UriKind.Relative ) );

Step 2 – In opened window you need to parse out the passed eventId.

Step 3 – Use FilterDescriptor to limit result set of the Domain Data Source.

This is easily done in your OnNavigatedTo event of a Silverlight 4 window.   The example here uses the QueryString to grab the key value from the URL.  The value is then applied to the WCF RIA Service Domain Data Source via a FilterDescriptor which is the closest thing to the actual retrieval argument logic in PowerBuilder.

// Executes when the user navigates to this page, grab eventID from URL.
protected override void OnNavigatedTo( NavigationEventArgs e )
  // this is step 2 logic
  string eventId = NavigationContext.QueryString["EventID"];
  // this is step 3 logic
  eventDomainDataSource.FilterDescriptors.Add( new FilterDescriptor
    PropertyPath = "EventID",
    Operator = FilterOperator.IsEqualTo,
    Value = eventId
  } );

Notice the URL, the EventID is passed.

Silverlight 4 - PowerBuilder Retrieval Argument
Silverlight 4 – PowerBuilder Retrieval Argument

This is ONE way of coding Silverlight 4 like the Retrieval Argument in PowerBuilder.    Remember it is specific to WCF RIA Services.

If you have any questions about the move from PowerBuilder to Silverlight please sent me a private email and I’d be happy to assist.



(aka Rich Bianco)

4 Responses

  1. Hey very nice blog!! Man .. Beautiful .. Amazing .. I will bookmark your blog and take the feeds also…I am happy to find so many useful information here in the post, we need develop more strategies in this regard, thanks for sharing. . . . . .

  2. Hey, I have been visiting your web site for a while now and I always pick up a gem in your new posts. Thanks for sharing. Thank You For This Post, added it to my favorites. Thanks once more for putting this online. I unquestionably loved every bit of it.

Leave a Reply to Dexter Aus Cancel reply

Your email address will not be published. Required fields are marked *