Showing posts with label based. Show all posts
Showing posts with label based. Show all posts

Tuesday, March 20, 2012

Association Scenario

Hi,

I have a product basket scenario in where I have to recommend contracts to a customer based on the product and the quantity he/she buys. Product Quantity is an important factor which administers the user in the purchase of a particular contract

I have the following tables with me.

Customer product transaction table, Customer Contract transaction tablebut there is no direct relationship between contract and product in the database. The only way the two can be linked is through the customer.

If I create a mining structure with Customer-Product information as the nested table and Customer-Contract information as the nested table with customer being the link between the two, the model is showing some irreverent contract recommendations.

what is the solution for the above problem? Is it because the is no direct relationship between the product and the contract?

How can I overcome this problem?

You are on the right track - you have the two nested tables that you need. What you want to do is to make the Product nested table as Input and the Contract nested table as Predict Only. Also, you may want to try excluding the product quantity to see how that impacts results.

Another important factor is how you set parameters for the AR algorithm. Setting the MINIMUM_SUPPORT and MINIMUM_PROBABILITY parameters are crucial - try lowering them until you find interesting results.

|||

Hi,

I tried the above changes but there was not much difference in the results. It still gives irrelevant recommendations.

Can you tell me how differentare the following two mining structures

1. Customertable => CASE Table

Customer – Product table => NESTED Table

Customer – Contract table => NESTED Table

2. Customer – Product table => CASE table

Customer – Contract table => NESTED Table

|||I'm not an expert in association but i think that in the first case

you're bound to have three kind of information : contract 1 /contract 2

OR product1 / product 2 OR contract / product (in fact it depends on

the key of your nested tables but in any case you'll get

contact/product association).
In the second case you won't have product1/product2 association. and the contract/ product association will have a support of 1

I don't really catch your problem but if you want to make the second mining structure, you will have to add customerID to your tables product and contract. With some sql queries, you should be able to prepare correctly your data|||

In the first structure it is possible for a single customer to have many products. In the second structure, each customer can only have one product.

Using the first model you can make Product INPUT and Contract PREDICT ONLY and you are asking the question the right way.

When you say it gives "irrelevant recommendations" what do you mean exactly? It could be that only the "irrelevant" ones are supported by the data, or you need to tweak the parameters a bit more.

If you aren't seeing what you want, use the same structure to create a decision tree model. This way you can look at the trees that are generated to see if there are meaningful patterns in the data. By default you will have 255 inputs (e.g. products) and 255 outputs (e.g. contracts), but that should be enough to get you started, you can adjust those parameters as necessary to refine the models.

Also, just for a question, how many customers, products, and contracts are there?

Thx

-Jamie

|||

Hi Jamie,

In the database there are totally around 800 customers, 300 products and 9 contracts.

These contracts are grouped logically in to long term, short term (depending on the product quantity) and some are applicable to certain products only.

Data in my database may look like the following

Customer - Product

Customer

Product

Quantity

Date

C1

P1

X

Jan 2005

C1

P1

Y

Feb 2005

C1

P2

X

March 2005

Customer – Contract

Customer

Contract

Date

C1

Contract1

June 2005 (For P1 bought in Jan 2005 as above)

C1

Contract2

March 2005 (For P1 bought in Feb 2005 as above)

C1

Contract3

March 2005 (For P2 bought)

So the relevant combinations would be

P1 – Quantity X – Contract1 (long term contract due to quantity X)

P1 – Quantity Y – Contract2 (short term contract due to quantity Y)

P2 – Quantity X – Contract 3 (Contract for the product type P3)

The other combinations are irrelevant.

These combinations or groupings are high level understanding and are not reflected at the technical level.

Some of the mining model recommendations are

1 . For the purchase of P1 of Quantity X apart from recommending Contract1 it also lists Contract2 and Contract3( irrelevant).

2. For P2 it recommends both Contract3 and Contract1 (irrelevant).

Associating Report Viewer (without UI) with Data Set

Hello all - I am looking to use the ReportViewer Control to automatically print out some client based reports.

I started with the "Print a report from a console app" sample from http://www.gotreportviewer.com/.

I have managed to convert an existing server based report from an RDL to an RDLC, and added it to my Console Project with VB.NET. In addition, I created a new Data Set within this project that returns the data from the original stored procedure that was used for the RDL file. I believe I have also successfully passed in the correct parameters to the sproc, but now I need to associate this new Data Set with the RDLC report. The RDLC has a simple table control that has a few fields from the new Data Set. When the report is rendered, I receive an exception indicating the following:

{"A data source instance has not been supplied for the data source "Production_stpProductionByDay"."}

It would seem that I need to programmatically associate my Data Set with the report, but I cannot seem to figure out the correct syntax.

Here is my Run method:

m_PhaseID = 1

m_ShiftID = 1

m_DateTime = Now()

Dim report As LocalReport = New LocalReport()

Dim parReport(2) As ReportParameter

Dim parDay As New ReportParameter("Day", m_DateTime)

Dim parPhaseID As New ReportParameter("PhaseID", m_PhaseID)

Dim parShiftID As New ReportParameter("ShiftID", m_ShiftID)

parReport(0) = parDay

parReport(1) = parPhaseID

parReport(2) = parShiftID

report.ReportPath = "C:\Documents and Settings\Kruse\My Documents\Visual Studio 2005\Projects\ShellyReportPrint\ShellyReportPrint\Production.rdlc"

report.SetParameters(parReport)

Export(report)

m_currentPageIndex = 0

Print()

Any help would be greatly appreciated! Thanks..

I have yet to find a solution for this issue... has anyone else implemented something similar?

If not, I guess I will have to wait until TechEd 2K6!

Sunday, March 11, 2012

Assigning values based on InitialToggleState of a control in SSRS

Hi,

I need to assign the value for a field in a report based on Expand/Collapse state of another field.

Eg. If Collapsed, the value should be "AA" else if Expanded "BB".

Is there any way to get the value of InitialToggleState for any field in SSRS.

Thanks in advance.

Sathya

Use True for Collapsed and False for Expanded.

As explained at the following link

http://www.manning-sandbox.com/thread.jspa?threadID=14881&tstart=60

Assigning values based on InitialToggleState of a control in SSRS

Hi,

I need to assign the value for a field in a report based on Expand/Collapse state of another field.

Eg. If Collapsed, the value should be "AA" else if Expanded "BB".

Is there any way to get the value of InitialToggleState for any field in SSRS.

Thanks in advance.

Sathya

Use True for Collapsed and False for Expanded.

As explained at the following link

http://www.manning-sandbox.com/thread.jspa?threadID=14881&tstart=60

Wednesday, March 7, 2012

Assign a variable based upon query results...how to do it?

I have the following code which is incomplete. Where it says:
txtVendorID =
I need it to equal the results of the field VendorID from my query...here is my code. What do I need to add there?

Dim cmdSelectAs SqlCommand
Dim intRecordID
intRecordID = Request.QueryString("RecordID")
strConn = ConfigurationManager.AppSettings("conn")
conn =New SqlConnection(strConn)
cmdSelect =New SqlCommand("spMfgRepListAddaspxByRecordID", conn)
cmdSelect.CommandType = CommandType.StoredProcedure
cmdSelect.Parameters.AddWithValue("@.RecordID", intRecordID)
conn.Open()cmdSelect.ExecuteReader()
txtVendorID.Text =
conn.Close()If VendorID is the only field coming back from your SP (ie SELECT VendorID FROM...) then you can do

txtVendorID.Text = cmdSelect.ExecuteScalar().ToString(); // Might have a problem with NULL's if the SP returns no results so guard against this

Otherwise you have to use

SqlDataReader dr = cmdSelect.ExecuteReader();

if ( dr.Read() )
txtVendorID.Text = dr["VendorID"].ToString(); // Assumes VendorID is the name of your field|||

hi.

you need to use datareader as;

Dim

readerAs SqlDataReader

reader = cmd.ExecuteReader()

reader.Reade()

txtVendorID.Text =reader(

"VendorID").ToString() ' VendorID which retrive from the database.

Thursday, February 16, 2012

ASP.Net with SQL Server

Hi All,

Could any one help me to know

How to return the Error Occured in Sql Server to ASP.Net Application with Customization based on the Error.

shiva kumar

If you are using an ObjectDataSource or SqlDataSource to connect to your database, then you could capture your error within the .Selected event of each control. You could also trap this error within a Try-Catch block. Either way, structure your error trapping from specific to general like so:
try{// Make my database call}catch (System.Data.SqlClient.SqlException ex){// Check the error number to be even more specificif (ex.Number == 2627){// We've just captured a primary key violation// Now do something here to customize your error display}}catch (Exception ex){// Some general error has occurred here}

Monday, February 13, 2012

ASP.NET Query

I need to display certain files from a directory based on a password. Could
someone point me in the right direction on how to do this. In my database i
store the file name and the password entered on the upload of the document.
When a user comes to download the document he/she needs to enter a password
before seeing any of the files available.
thanks in adv. for any and all help.I'm not sure I understand - can you elaborate? If you are already asking the
m
for a name and password for the upload, why not use that same method for the
download?
"Ben" wrote:

> I need to display certain files from a directory based on a password. Coul
d
> someone point me in the right direction on how to do this. In my database
i
> store the file name and the password entered on the upload of the document
.
> When a user comes to download the document he/she needs to enter a passwor
d
> before seeing any of the files available.
> thanks in adv. for any and all help.

ASP.NET MS SQL Server cyrillic problem

Hi,
I have a ASP.NET application which is hosted on English - based server. This
application works with MS SQL Server, also English-based. I have this in my
Web.config:
<globalization fileEncoding="windows-1251" requestEncoding="windows-1251"
responseEncoding="windows-1251" culture="bg-BG" uiCulture="bg-BG" />
When I insert some text in the database, I mean cyrrilic text, it couldn't
be read, because the result is '''.
Could you tell me hou should I fix this problem?
Thank you in advance!
ViktorVictor, first thing to look at is what's a data-type of the targeted field,
is nvarchar, nchar or ntext as opposed to varchar or text?
Also by what means is text inserted; bulk insert, ado, ado.net?
"Viktor Popov" <viketo@.yahoo.com> wrote in message
news:%232Rtw%23fLFHA.3016@.TK2MSFTNGP15.phx.gbl...
> Hi,
> I have a ASP.NET application which is hosted on English - based server.
This
> application works with MS SQL Server, also English-based. I have this in
my
> Web.config:
> <globalization fileEncoding="windows-1251" requestEncoding="windows-1251"
> responseEncoding="windows-1251" culture="bg-BG" uiCulture="bg-BG" />
> When I insert some text in the database, I mean cyrrilic text, it
couldn't
> be read, because the result is '''.
> Could you tell me hou should I fix this problem?
> Thank you in advance!
>
> Viktor
>|||> Also by what means is text inserted; bulk insert, ado, ado.net?
I am sorry, I didn't pay attention to the title of your post. If your
web.config settings are correct that should work. But assuming user is
submitting double byte data.
"LP" <lp@.a.com> wrote in message
news:unRxTckLFHA.3016@.TK2MSFTNGP15.phx.gbl...
> Victor, first thing to look at is what's a data-type of the targeted
field,
> is nvarchar, nchar or ntext as opposed to varchar or text?
> Also by what means is text inserted; bulk insert, ado, ado.net?
> "Viktor Popov" <viketo@.yahoo.com> wrote in message
> news:%232Rtw%23fLFHA.3016@.TK2MSFTNGP15.phx.gbl...
> This
> my
requestEncoding="windows-1251"
> couldn't
>|||Do you mean that I should insert into database unicode?
Thank you for the reply!
"LP" <lp@.a.com> wrote in message
news:u7GHj8kLFHA.732@.TK2MSFTNGP12.phx.gbl...
> I am sorry, I didn't pay attention to the title of your post. If your
> web.config settings are correct that should work. But assuming user is
> submitting double byte data.
>
> "LP" <lp@.a.com> wrote in message
> news:unRxTckLFHA.3016@.TK2MSFTNGP15.phx.gbl...
> field,
server.
in
> requestEncoding="windows-1251"
>|||Yes, you should insert cyrilic text as nvarchar or ntext. I am pretty sure
cyrillic uses double-byte i.e. unicode encoding.
"Viktor Popov" <viketo@.yahoo.com> wrote in message
news:%23O36bSrLFHA.1528@.TK2MSFTNGP09.phx.gbl...
> Do you mean that I should insert into database unicode?
> Thank you for the reply!
> "LP" <lp@.a.com> wrote in message
> news:u7GHj8kLFHA.732@.TK2MSFTNGP12.phx.gbl...
> server.
this
> in
>

Sunday, February 12, 2012

ASP.NET cube administration?

Hi all!

We would like to create an Intranet based cube administration tool.

Power users should be able to process cubes and dimensions. This works

and all the cubes, dimensions and even databases from the SSAS can be

displayed in the web! ASP.NET@.C# combined with

Microsoft.AnalysisServices offer a lot of very good possibilities!

But we still have a problem:

How ist it possible to show some kind of progress bar (maybe in a self refreshing iframe or a new window?)?

When a cube/dimension is processed the user does not get ANY feedback

(of course the webserver waits to finish the process() method.

I tried to start a different thread an this even works!

I want to show our powerusers at least some kind of progress (%, events, what ever).

can someone help? we are totally lost with that topic!

I already had a look at the example from:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=75148&SiteID=1

But it did not lead me to a propper solution :)

TIA and regards

JohnnyR

Hi Johnny,

i have tried to configure the display of my dimensions and cube on the Web but I have totally failed, could you please outline for me the proper steps of how togo about this.

You can reach me on REjalu@.cit.mak.ac.ug. or within the forums

Thanx in advance.

Ronald

|||

Hi,

maybe you should have an eye on http://www.lennybacon.com/Default.aspx#a0eaaccb3-4c0c-405f-9bde-ced4b95a1222?

cheers,
Markus

|||Hi Ronald!

This is how I manage it:

string olapserver = @."SERVER\DATABASE";


private bool getDBs()

{

Server olapsrv = new Server();

this.DropDownDatabase.Items.Clear();

try

{

olapsrv.Connect(olapserver);

foreach (Database mydb in olapsrv.Databases)

{

ListItem myitem = new ListItem();

myitem.Text = mydb.ToString();

myitem.Value = mydb.ToString();

this.DropDownDatabase.Items.Add(myitem);


}

olapsrv.Disconnect();

return true;

}

catch

{

olapsrv.Disconnect();

return false;

}

}


private bool getCubes(string server)

{

Server olapsrv = new Server();

this.ListBoxCubes.Items.Clear();

try

{

olapsrv.Connect(olapserver);

foreach (Cube mycube in olapsrv.Databases[server].Cubes)

{

ListItem myitem = new ListItem();

myitem.Text = mycube.ToString();

myitem.Value = mycube.ToString();

this.ListBoxCubes.Items.Add(myitem);

}

olapsrv.Disconnect();

return true;

}

catch

{

olapsrv.Disconnect();

return false;

}

}


private bool getDimensions(string server)

{

Server olapsrv = new Server();

this.ListBoxDimensions.Items.Clear();

try

{

olapsrv.Connect(olapserver);

foreach (Dimension mydimension in olapsrv.Databases[server].Dimensions)

{

ListItem myitem = new ListItem();

myitem.Text = mydimension.ToString();

myitem.Value = mydimension.ToString();

this.ListBoxDimensions.Items.Add(myitem);

}

olapsrv.Disconnect();

return true;

}

catch

{

olapsrv.Disconnect();

return false;

}

}

.

.

.

<asp:DropDownList ID="DropDownDatabase" runat="server" AutoPostBack="true" />

<asp:ListBox ID="ListBoxCubes" runat="server" SelectionMode="Multiple" />

<asp:ListBox ID="ListBoxDimensions" runat="server" SelectionMode="Multiple" />
good luck!

I finally managed to get the admin page working:

My solution was the following:

I created a Windows Command Line Application that processes either

cubes or dimensions. The Application get an XMLA File Path as a command

line argument.

The XMLA file is created by my Administrator Web Page, which also launches the Command Line Tool!

The Command Line tool traces the server output and writes it into a log file!

The log file is display in an iframe (reload every 5seconds).

It works great and really fast using XMLA.

maybe somebody want to do the same!

regards

JohnnyR|||

Johnny,

if you are going to share this app with the community somewhere I would be glad if you notify me and send me a download link...

cheers;
Markus

|||Hi Markus!

Give me some time to clean up the code an to design the whole stuff a bit more understandable :)

But i will definitely post it in here or post a downloadable link!

We concidered to write a dynamic MDX query generator for the web (like

you know from the pivot table drag and drop plug in @. Excel), too! So

give me some time to design the prog a bit better ;)

regards from Vienna

JohnnyR|||

from Vienna?
Then we could do it in german also...
:-)

Glad to hear that you think of posting it!

Have you thought of getting in touch with some other projects regarding SSAS and web-"things"?
PASS Germany is currently doing a project in the SIG BI which will be a AJAX Client for SSAS.

If you would like to get in contact please just send me a mail to m.fischer [at] sqlpass.de

cheers,
Markus

ASP.Net and MS SQL

Dreamweaver MX and ASP.Net and MS SQL

I am displaying a page of lists of addresses based on state.

.../results.aspx?state=id

I want to add a little "re-sort" links. For example: sort by | name | city | style

.../results.aspx?state=id&sort=city
(if sort is missing default to "sort=name")

But I a having a problems... here is part of my code, following dreamwevers standards for ASP.Net -

CommandText='<%# "SELECT * FROM tblRestaurants WHERE ""State"" = @.State ORDER BY @.Sort ASC" %>'

<parameters>
<parameter name="@.State" value='<%# IIf((Request.QueryString("state") <> Nothing), Request.QueryString("state"), "") %>' type="VarChar" />
<parameter name="@.Sort" value='<%# IIf((Request.QueryString("sort") <> Nothing), Request.QueryString("sort"), "name") %>' type="VarChar" />
</parameters
But "@.Sort" is causing errors, I think @. is a reserved keyword in MS SQL (?),
here is the error message -

System.Data.SqlClient.SqlException: The SELECT item identified by the ORDER BY number 1 contains a variable as part of the expression identifying a column position. Variables are only allowed when ordering by an expression referencing a column name.

I have tried to change @.Sort about a dozen different names "MMSort", "urlSort" etc.
here is the error message -

System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near 'urlSort'.

One side note, I displaying the results in a repeating datalist, a datagrid is out.
A rough draft version without working sort is at
http://www.jbmcgregor.com/cira/results.aspx?state=id

Any suggestion, ideas or help would be extremely appreciated. Thanks.

DanielIt would help if you provide the actual sql query that gets executed. Use Try...Catch to catch the exception and use response.write to figure out exactly what was the sql command that gets executed. Probably it is a systax error.

Thursday, February 9, 2012

ASP.NET 2.0 Tree Control and Navigation Controls - General Question

Hi.
Why is it practical to have the ASP.NET navigation controls based on
XML? I would love to just use databinding and then be able to
dynamically update the navgiation menu (e.g. for a product list).
I tried to use a dropdownlist with hyperlinks for navigation (not the
main navigation -- a navigation subset) and even a listbox, but found
it very cumbersome.
The way I figure it now, is that I have to pull the data over from Sql
Server, convert it to XML, reformat into the appropriate nodes, and the
then populate the navigaiton control..
Is there an easier way to do this? What am I missing'
Thanks in advance!
-RanginaldI guess the more elegant way of doing that would be to implement a
custom site-map provider based on your data. You'd have a better luck if
you posted this on asp.net newsgroups though.
hth
Hirantha
Please reply only to the newsgroups.When posting, inclusion of SQL
(CREATE TABLE ..., INSERT ..., etc.) which
can be cut and pasted into Query Analyzer is appreciated.
*** Sent via Developersdex http://www.examnotes.net ***

ASP.Net 2.0 Application Connection to SQL Server 2005 - Setup Questions

All:

I am writing an Internet/Extranet based (ASP.Net 2.0) web application that uses SQL server 2005 as the database. I am using forms authentication on my web application. I am also storing the connection string to SQL server in my web config file. The conn string is encrypted using DPAPI with entropy. I currently have created a SQL login account on my SQL server for use by the web application. This is the user ID I am using in my conn string. The reason for this is because all persons using the application will NOT have a windows login.

Here is my question: The login I created currently has defaulted to the "dbo" role and therefore has "dbo" rights to the database. I want to setup up this login accountso that all it can do is execute stored procedures. I dont want this SQL login to be able to do anything else. In my application I am using stored procedures for ALL data access functions, via a data access layer in my application. Can someone guide me step by step as to how to setup this type of access for this SQL login.

Thanks,

Blue.

The dbo user/role rights cannot be changed at all. It is the intrinsic owner of all objects in sql server and has access to all of them, whether you want it or not.

What you need to do, is to create your own sql server user, something like "MyApplicationUser", that only has exec access toyour stored procedures.

Don't go messing around with the dbo user, you can mess up your sql server installation really fast.

|||

Yes that is what I have done. I created a SQL server user/login. The only issue is when I created this I did not assign to any roles except public. Currently I have NOT granted explicit permissions to this login, to any objects, yet it is still able to run the SP's. When I look at the login I created, it states that the default schema is "dbo", therefore it is giving this login way more access then it needs.

|||

Still need help, anyone have any ideas or help? Please!

|||

Hi,

You may create your own role and add your user to that role. Here's the articles for you to refer.

http://msdn2.microsoft.com/en-us/library/ms187936(SQL.90).aspx

http://msdn2.microsoft.com/en-us/library/ms173463(SQL.90).aspx

Thanks.