VMWare

March 28, 2011

I wanted to be able to access my VMWare (7.0) websites from my host machine (and ultimately, from the outside world)—for testing SLX Mobile 2011 customizations, for one.

I found this old (2006) article: Allow Access to a VMware Virtual Machine(NAT) From Another Computer. But things have changed a little since then. So here are the updated steps:

1. On the machine with the website you want to be able to access, open a Command Prompt, and type in ipconfig. Note the IP Address of the machine.

2. On the same active machine, in the VMWare console go to VM -> Settings…, and on the Hardware tab, select Network Adapter. In the lower right-hand side of the page, change the Network connection setting to Custom: specific virtual network, and select VMnet8 (NAT) from the drop-down. Click OK.

3. In the VMWare console, go to Edit -> Virtual Network Editor….

4. Select the VMnet8 network, and click the NAT Settings… button.

5. Under Port Forwarding, click the Add button, and enter the Host port (e.g., 8080), Virtual machine IP address (from #1), and Virtual machine port (e.g., 80).

6. OK out of all of the boxes, to set the info and automatically restart the DHCP and NAT Services.

If you now type in http://localhost:8080 into the address bar of a browser on your host machine, you should be able to see the (default, port 80) website on the VMWare virtual machine.

Advertisements

SSRS

March 27, 2011

I’ve been creating SQL Server Reporting Services (2005) reports for an independent client of mine for several years, after spending six months writing them for a Microsoft Certified Partner back in 2006.

If you ever need to work with multi-valued parameters in SSRS 2005, you need to know about the following, life-saving page:

Passing multi-value parameter in stored procedure (SSRS report).

In case of sql query as well as stored procedure, all selected values of the multi-value parameter will be passed as ‘,’ (comma) separated. So we should use IN clause in WHERE to impose the desired condition.

Problem: If we use stored procedure passing an input parameter which is multi-value parameter, SSRS will take all those selected multiple values as different-2 parameters (as they all are ‘,’ separated). And thus if we do multiple selection (or SelectAll) error would be there, though it will work fine if we select only one value.

error(s): Must Declare Scalar variable @parameter OR number of parameters being passed are more than expected….

Now if preview the report it will work fine for single value of color, but if we select multiple colors from colors parameters, it will give error. To pass the complete list of selected values of @color parameter as a single value/string we should use a function JOIN().

In data set properties of AdventureWorks dataset, click on parameters tab and use JOIN() funtion as:

=JOIN(Parameters!Color.Value, “,”)

This function will join all the color values and will a give a comma separated values thus a single value as a whole will be passed to the SP….

To use this list of comma separated values in the stored procedure we need to split them in a proper way as they are as : ‘value1, value2, value3′, but we need them as ‘value1′, ‘value2′, ‘value3′ to use them in IN clause. So we need to have a UDF function which will take this string of values and will return all them splitted. And then use them in SP as:WHERE @Color IS NULL OR Color IN (SELECT * FROM SplitList(@Color, ‘,’))

where SplitList is a UDF which takes the list and the de-limiter as input parameters and splits all the values.

The function I always use for splitting is one I found in a book years ago:

CREATE FUNCTION [dbo].[fn_MVParam](@RepParam nvarchar(4000),
   @Delim char(1)=',')
RETURNS @Values TABLE (Param nvarchar(4000)) AS
   BEGIN
   DECLARE @chrind INT
   DECLARE @Piece nvarchar(4000)
   SELECT @chrind = 1
   WHILE @chrind > 0
      BEGIN
         SELECT @chrind = CHARINDEX(@Delim, @RepParam)
         IF @chrind > 0
            SELECT @Piece = LEFT(@RepParam, @chrind - 1)
         ELSE
            SELECT @Piece = @RepParam
         INSERT @Values(Param) VALUES (@Piece)
         SELECT @RepParam = RIGHT(@RepParam, LEN(@RepParam) - @chrind)
         IF LEN(@RepParam) = 0 BREAK
      END
   RETURN
END

SLX Web FAQ

March 15, 2011

I’ve been working on my first SLX Web project, going through the extreme learning curve for that over the past two weeks—adapting an existing LAN Tickets customization for the Web client.

Today, I stumbled on the following valuable document: Sage_SalesLogix_72_Web_Client_Programming_FAQ.