[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3178
  • Last Modified:

Pass parameter from ASP.Net page to Cognos to create report

Hi Experts,

I have an ASP.NET webpage with a gridview in which I have placed a Hyperlink field whose value is my Order ID (the key to my SQL table). I have a Cognos report built with a prompt page where in you can choose the Order ID and it will give you details for that Order. The gridview shows cursory information for each unprocessed Order in the SQL table. My charge is this: to put an HTML Link in the GridView so that the person using that webpage can click on the Order ID link and produce a detailed report for that Order. I almost have it working except when I click on the HTML link it takes me to the Prompt page and I have to select the Order ID again from the Prompt page in order to produce the report for that Order. Is there any way to send a parameter with the Cognos report request so that it knows which Order I want to produce the report for, rather than having to re-select the Order ID on the Prompt page?

I have pasted my .aspx page code.

Thanks,

taduh
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="CDARS_Acct_Placements._Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
    <title>Untitled Page</title>
    <style type="text/css">
 
 
        .hiddencol
        {
           display:none;
        }
</style>
    <form id="form2" runat="server">
    <table bgcolor="#0B01C5">
        <tr>
            <td>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </td>
            <td>
                <asp:Label ID="lblHeader" runat="server" Font-Bold="True" Font-Italic="True" 
                    Font-Names="Times New Roman" Font-Size="XX-Large" Font-Underline="True" 
                    ForeColor="#FFFF99" Text="CDARS Placed Orders"></asp:Label>
            </td>
            <td>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </td>
            <td>
                &nbsp;&nbsp;&nbsp;&nbsp;
            </td>
        </tr>
    </table>
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AutoGenerateColumns="False" BackColor="#FFFFAE" BorderColor="#0000CC" 
        BorderStyle="Solid" CellPadding="10" DataKeyNames="Order_ID" 
        DataSourceID="SqlDataSource1" Font-Bold="True" Font-Names="Trebuchet MS" 
        Font-Size="Small" GridLines="None" PageSize="15" HeaderStyle-Wrap="False">
        <PagerSettings FirstPageText="First" LastPageText="Last" Mode="NextPrevious" 
            NextPageText="Next" Position="TopAndBottom" PreviousPageText="Prev" />
        <RowStyle HorizontalAlign="Left" VerticalAlign="Top" />
        <Columns>
            <asp:TemplateField HeaderText="Processed">
                <ItemTemplate>
                    <asp:CheckBox ID="Order_Processed" runat="server" AutoPostBack="true" 
                        Checked='<%# Databinder.Eval(Container.DataItem, "Order_Processed") %>' 
                        OnCheckedChanged="Check_Clicked" />
                </ItemTemplate>
                <ItemStyle BackColor="White" />
            </asp:TemplateField>
            <asp:BoundField DataField="Order_ID" HeaderText="Order ID" 
                SortExpression="Order_ID" />
            <asp:HyperLinkField DataTextField = "Order_ID" runat="server" 
                    DataNavigateUrlFields ="Order_ID"
                    DataNavigateUrlFormatString = "http://essdev/cognos8.2/cgi-bin/cognos.cgi?b_action=xts.run&amp;m=portal/report-viewer.xts&amp;ui.action=run&amp;ui.object=%2fcontent%2fpackage%5b%40name%3d%27CDARS%27%5d%2freport%5b%40name%3d%27CDARS%20Account%20Place%20Order%27%5d&amp;cv.ccurl=1&amp;ui.backURL=%2fcognos8.2%2fcgi-bin%2fcognos.cgi%3fb_action%3dxts.run%26m%3dportal%2fcc.xts%26m_folder%3"
                    Target="_blank"
                    HeaderText = "Click for Report" />    
            <asp:BoundField DataField="Cust_Customer1_Name" HeaderText="Cust1 Name" 
                SortExpression="Cust_Customer1_Name" >
                <HeaderStyle Wrap="False" />
                <ItemStyle Wrap="False" />
            </asp:BoundField>
            <asp:BoundField DataField="Order_Customer2_Name" HeaderText="Cust2 Name" 
                SortExpression="Order_Customer2_Name" HtmlEncode="False" >
                <HeaderStyle Wrap="False" />
                <ItemStyle Wrap="False" />
            </asp:BoundField>
            <asp:BoundField DataField="Order_Cust_Sig" HeaderText="Cust Sig?" 
                SortExpression="Order_Cust_Sig" />
            <asp:BoundField DataField="Order_Amount" HeaderText="Amount" 
                SortExpression="Order_Amount" DataFormatString="{0:C2}" 
                HtmlEncode="False" />
            <asp:BoundField DataField="Order_Placement_Date" HeaderText="Place Date" 
                SortExpression="Order_Placement_Date" DataFormatString="{0:d}" />
            <asp:BoundField DataField="Location_Name" HeaderText="Branch" 
                SortExpression="Location_Name" HtmlEncode="False" >
                <ItemStyle Wrap="False" />
            </asp:BoundField>
            <asp:BoundField DataField="Order_LANID" HeaderText="Branch Rep" 
                SortExpression="Order_LANID" >
                <HeaderStyle Wrap="False" />
                <ItemStyle Wrap="False" />
            </asp:BoundField>
            <asp:BoundField DataField="Order_Date" HeaderText="Submit Date/Time" 
                InsertVisible="False" ReadOnly="True" SortExpression="Order_Date" > 
                <HeaderStyle Wrap="False" />
                <ItemStyle Wrap="False" />
            </asp:BoundField>
        </Columns>
        <HeaderStyle Font-Bold="True" Font-Names="Trebuchet MS" Font-Underline="True" 
            ForeColor="#0000CC" Wrap="False" />
        <AlternatingRowStyle BackColor="White" BorderColor="Blue" BorderStyle="Solid" 
            BorderWidth="1px" ForeColor="Black" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:CDARSConnectionString %>" 
        
        
        SelectCommand="SELECT [Order_ID], [Cust_Customer1_Name], [Order_Processed], [Order_Customer2_Name], [Order_Cust_Sig], [Order_Amount], [Order_Placement_Date], [Location_Name], [Order_LANID], [Order_Date] FROM [vw_CDARS_Order_Placements] WHERE ([Order_Processed] = @Order_Processed) ORDER BY [Order_ID] DESC">
        <SelectParameters>
            <asp:Parameter DefaultValue="False" Name="Order_Processed" Type="Boolean" />
        </SelectParameters>
    </asp:SqlDataSource>
   </form>
</body>
</html>

Open in new window

0
taduh
Asked:
taduh
1 Solution
 
RWrigleyCommented:
You can specify the prompt values on the URL to the report.  This document describes all the fun things you can do with URL's with Cognos:

http://support.cognos.com/supported/tti/public/docs/cognos_pp_reporting_using_urls_in_cognos_8.pdf?lid=cognos_pp_reporting_using_urls_in_cognos_8

This is from the section you're interested in:
Passing Prompt Answers
To ignore the prompt page, the parameter run.prompt must be set to false. Otherwise, the
prompt page will appear with your prompt answer as the highlighted selection.

http://server-name/Cognos8/cgibin/
cognos.cgi?b_action=xts.run&m=portal/launch.xts&&ui.tool=CognosViewer&ui.object=
/content/package[@name='GO Sales and Retailers']/folder[@name='New
Reports']/report[@name='product revenue - prompt']&ui.action=run&p_Product name=Bear
Edge&run.prompt=false
0
 
taduhFinancial Systems AnalystAuthor Commented:
RWrigley,

The information you provided is helpful. I was able to suppress the prompt page; the only trouble I'm having now is getting it to recognize the gridview field, Order_ID as containing the prompt value. If I  hard-code the Order ID like  p_Order_ID=165 the report will successfully run, but I'm looking for a way for it to take the Order ID associated with the selected line on the Gridview as the prompt value and create the report from that. Whenever I do something like p_Order_ID=Order_ID I get an error saying "Invalid format for numeric prompt 'Order_ID'." i.e. Its not resolving to the value of Order_ID in the gridview. Any ideas on how to make it do this?

Thanks,

taduh
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now