How to work in Crystal Report with Object Data Source? - winforms

How to work in Winforms Crystal Report with Object Data Source?
So far I have found web-links to use Crystal Report with DataSets or Databases directly.
Can anyone show me how to do it like this?

its the same as before...
reportDocument.SetDataSource(List1);

<CR:CrystalReportViewer ID="crvmyDataReport" runat="server"
ReportSourceID="crsmyData" EnableDatabaseLogonPrompt="False" DisplayGroupTree="False"
EnableParameterPrompt="False" ReuseParameterValuesOnRefresh="True"
BorderStyle="Solid" BorderColor="Black" BorderWidth="1px" />
<br />
<CR:CrystalReportSource ID="crsmyData" runat="server">
<Report FileName="myData.rpt">
<DataSources>
<CR:DataSourceRef DataSourceID="odsmyData" TableName="myData" />
</DataSources>
</Report>
</CR:CrystalReportSource>
<asp:ObjectDataSource ID="odsmyData" runat="server"
OldValuesParameterFormatString="original_{0}" SelectMethod="myDataQuery"
TypeName="myDataAppTableAdapters.myDataTableAdapter">
<SelectParameters>
<asp:ControlParameter ControlID="tb1" ConvertEmptyStringToNull="False"
DbType="String" Name="p1" PropertyName="Text" />
<asp:ControlParameter ControlID="tb2" ConvertEmptyStringToNull="False"
DbType="String" Name="p2" PropertyName="Text" />
<asp:ControlParameter ControlID="tb3" ConvertEmptyStringToNull="False"
DbType="String" Name="p3" PropertyName="Text" />
<asp:ControlParameter ControlID="ddl1" ConvertEmptyStringToNull="False"
DbType="String" Name="p4" PropertyName="SelectedValue" />
</SelectParameters>
</asp:ObjectDataSource>

Related

Word online SSO - getAccessTokenAsync no respons no error

I have created an Office add-in for Word Online but I can't get SSO working.
When the add-in is activated Word Online prompts the user for accepting the Add-in permissions, But I can’t get the SSO Token via Office.js.
When getAccessTokenAsync() first is called, I get no response or errors. If I call the function again I get error code 13008. Which indicate that the operation is running, but the result is never returned.
The manifest file is provided with
<WebApplicationInfo>
<Id>00e69b3f-c86c-4764-9e6e-xxxxxxxx</Id>
<Resource>api://localhost:43443/00e69b3f-c86c-4764-9e6e-xxxxxxxx </Resource>
<Scopes>
<Scope>openid</Scope>
<Scope>offline_access</Scope>
<Scope>user.read</Scope>
<Scope>profile</Scope>
</Scopes>
</WebApplicationInfo>
Azure Endpoint v2 registration
The add-in is registered at https://apps.dev.microsoft.com
Platform Web Api:
api://localhost:43443/00e69b3f-c86c-4764-9e6e-xxxxxxxx
Pre-authorized application:
bc59ab01-8403-45c6-8796-ac3ef710b3e3
57fb890c-0dab-4253-a5e0-7188c88b2bb4
d3590ed6-52b3-4102-aeff-aad2292ab01c
Permissions:
openid
offline_access
user.read
Profile
I have granted administrator consent using
https://login.microsoftonline.com/common/adminconsent?client_id=00e69b3f-c86c-4764-9e6e-xxxxxxxx&state=12345
Update:
If the same manifest is sideloaded into Powerpoint online or Excel/Spreadsheet online it can get the token by calling getAccessTokenAsync(), but still not in Word Online
Document Host
<Hosts>
<!--Each host can have a different set of commands. Cool huh!? -->
<!-- Workbook=Excel Document=Word Presentation=PowerPoint -->
<!-- Make sure the hosts you override match the hosts declared in the top section of the manifest -->
<Host xsi:type="Document">
<!-- Form factor. Currenly only DesktopFormFactor is supported. We will add TabletFormFactor and PhoneFormFactor in the future-->
<DesktopFormFactor>
<!--GetStarted information used on the callout that appears when installing the add-in.
Ensure you have build 16.0.6769 or above for GetStarted section to work-->
<GetStarted>
<!--Title of the Getting Started callout. resid points to a ShortString resource -->
<Title resid="dt.GetStarted.Title"/>
<!--Description of the Getting Started callout. resid points to a LongString resource -->
<Description resid="dt.GetStarted.Description"/>
<!--Not used right now but you need to provide a valid resource. We will add code in the future to consume this URL.
resid points to a Url resource -->
<LearnMoreUrl resid="dt.GetStarted.LearnMoreUrl"/>
</GetStarted>
<!--Function file is an html page that includes the javascript where functions for ExecuteAction will be called.
Think of the FunctionFile as the "code behind" ExecuteFunction-->
<FunctionFile resid="dt.FunctionFile.Url" />
<!--PrimaryCommandSurface==Main Office Ribbon-->
<ExtensionPoint xsi:type="PrimaryCommandSurface">
<!--Use OfficeTab to extend an existing Tab. Use CustomTab to create a new tab -->
<!-- Documentation includes all the IDs currently tested to work -->
<CustomTab id="dt.Tab1">
<!--Group ID-->
<Group id="dt.Tab1.Group1">
<!--Label for your group. resid must point to a ShortString resource -->
<Label resid="dt.Tab1.GroupLabel" />
<Icon>
<!-- Sample Todo: Each size needs its own icon resource or it will look distorted when resized -->
<!--Icons. Required sizes 16,31,80, optional 20, 24, 40, 48, 64. Strongly recommended to provide all sizes for great UX -->
<!--Use PNG icons and remember that all URLs on the resources section must use HTTPS -->
<bt:Image size="16" resid="dt.TaskpaneButton.Icon" />
<bt:Image size="32" resid="dt.TaskpaneButton.Icon" />
<bt:Image size="80" resid="dt.TaskpaneButton.Icon" />
</Icon>
<!--Control. It can be of type "Button" or "Menu" -->
<Control xsi:type="Button" id="dt.LetterButton">
<!--Label for your button. resid must point to a ShortString resource -->
<Label resid="dt.LetterButton.Label" />
<Supertip>
<!--ToolTip title. resid must point to a ShortString resource -->
<Title resid="dt.LetterButton.Label" />
<!--ToolTip description. resid must point to a LongString resource -->
<Description resid="dt.LetterButton.Tooltip" />
</Supertip>
<Icon>
<bt:Image size="16" resid="dt.LetterButton.Icon16" />
<bt:Image size="32" resid="dt.LetterButton.Icon32" />
<bt:Image size="80" resid="dt.LetterButton.Icon80" />
</Icon>
<!--This is what happens when the command is triggered (E.g. click on the Ribbon). Supported actions are ExecuteFuncion or ShowTaskpane-->
<!--Look at the FunctionFile.html page for reference on how to implement the function -->
<Action xsi:type="ExecuteFunction">
<!--Name of the function to call. This function needs to exist in the global DOM namespace of the function file-->
<FunctionName>ShowDialog</FunctionName>
</Action>
</Control>
<Control xsi:type="Button" id="dt.PhraseButton">
<!--Label for your button. resid must point to a ShortString resource -->
<Label resid="dt.PhraseButton.Label" />
<Supertip>
<!--ToolTip title. resid must point to a ShortString resource -->
<Title resid="dt.PhraseButton.Label" />
<!--ToolTip description. resid must point to a LongString resource -->
<Description resid="dt.PhraseButton.Tooltip" />
</Supertip>
<Icon>
<bt:Image size="16" resid="dt.PhraseButton.Icon16" />
<bt:Image size="32" resid="dt.PhraseButton.Icon32" />
<bt:Image size="80" resid="dt.PhraseButton.Icon80" />
</Icon>
<!--This is what happens when the command is triggered (E.g. click on the Ribbon). Supported actions are ExecuteFuncion or ShowTaskpane-->
<!--Look at the FunctionFile.html page for reference on how to implement the function -->
<Action xsi:type="ExecuteFunction">
<!--Name of the function to call. This function needs to exist in the global DOM namespace of the function file-->
<FunctionName>ShowDialog</FunctionName>
</Action>
</Control>
</Group>
<Group id="dt.Tab1.Group2">
<!--Label for your group. resid must point to a ShortString resource -->
<Label resid="dt.Tab1.GroupLabel2" />
<Icon>
<!-- Sample Todo: Each size needs its own icon resource or it will look distorted when resized -->
<!--Icons. Required sizes 16,31,80, optional 20, 24, 40, 48, 64. Strongly recommended to provide all sizes for great UX -->
<!--Use PNG icons and remember that all URLs on the resources section must use HTTPS -->
<bt:Image size="16" resid="dt.TaskpaneButton.Icon" />
<bt:Image size="32" resid="dt.TaskpaneButton.Icon" />
<bt:Image size="80" resid="dt.TaskpaneButton.Icon" />
</Icon>
<Control xsi:type="Button" id="dt.SignonButton">
<!--Label for your button. resid must point to a ShortString resource -->
<Label resid="dt.SignonButton.Label" />
<Supertip>
<!--ToolTip title. resid must point to a ShortString resource -->
<Title resid="dt.SignonButton.Label" />
<!--ToolTip description. resid must point to a LongString resource -->
<Description resid="dt.SignonButton.Tooltip" />
</Supertip>
<Icon>
<bt:Image size="16" resid="dt.SignonButton.Icon16" />
<bt:Image size="32" resid="dt.SignonButton.Icon32" />
<bt:Image size="80" resid="dt.SignonButton.Icon80" />
</Icon>
<!--This is what happens when the command is triggered (E.g. click on the Ribbon). Supported actions are ExecuteFuncion or ShowTaskpane-->
<!--Look at the FunctionFile.html page for reference on how to implement the function -->
<Action xsi:type="ExecuteFunction">
<!--Name of the function to call. This function needs to exist in the global DOM namespace of the function file-->
<FunctionName>OpenAccountStatus</FunctionName>
</Action>
</Control>
<Control xsi:type="Button" id="dt.SignonButton3">
<!--Label for your button. resid must point to a ShortString resource -->
<Label resid="dt.SignonButton.Label" />
<Supertip>
<!--ToolTip title. resid must point to a ShortString resource -->
<Title resid="dt.SignonButton.Label" />
<!--ToolTip description. resid must point to a LongString resource -->
<Description resid="dt.SignonButton.Tooltip" />
</Supertip>
<Icon>
<bt:Image size="16" resid="dt.SignonButton.Icon16" />
<bt:Image size="32" resid="dt.SignonButton.Icon32" />
<bt:Image size="80" resid="dt.SignonButton.Icon80" />
</Icon>
<!--This is what happens when the command is triggered (E.g. click on the Ribbon). Supported actions are ExecuteFuncion or ShowTaskpane-->
<!--Look at the FunctionFile.html page for reference on how to implement the function -->
<Action xsi:type="ShowTaskpane">
<TaskpaneId>ButtonId1</TaskpaneId>
<!-- Provide a url resource id for the location that will be displayed on the task pane. -->
<SourceLocation resid="Contoso.Taskpane.Url" />
</Action>
</Control>
</Group>
<!-- Label of your tab -->
<!-- If validating with XSD it needs to be at the end, we might change this before release -->
<Label resid="dt.Tab1.TabLabel" />
</CustomTab>
</ExtensionPoint>
</DesktopFormFactor>
</Host>

ExtJs4 - Form defined in javascript multicombo loaded at runtime

When the form is initially loaded the multicombo on the form correctly reflects the data that is set up.
However, if I attempt to update the information at runtime, the list of options in the multicombo aren't updated when the form is displayed.
I have them successfully defined as form options, they have a simple 'text' only store. However, I can't seem to find the correct set of properties and method to actually update the multicombo from the C# code as needed.
I've noticed this as well. You can set the Ext.net.ListItems on page-load but they are fickle when it comes to setting them dynamically in code-behind. I now always use a Ext.net.Store with any Multicombo or ComboBox that needs to dynamically change.
You can use the Handler events on Focus or BeforeSelect to reload the list.
<ext:ComboBox ID="ComboBoxTransferGroupMembers" runat="server" FieldLabel="Transfer To" EmptyText="Group Members" LabelAlign="Top" DisplayField="Name" ValueField="Id" MarginSpec="0 0 5">
<Listeners>
<Focus Handler="#{ComboBoxTransferGroupMembers}.store.reload()" />
</Listeners>
<Store>
<ext:Store runat="server" OnReadData="StoreTransferGroupMember_ReadData" ID="StoreXferGroup">
<Model>
<ext:Model IDProperty="Id" runat="server">
<Fields>
<ext:ModelField Name="Name" />
<ext:ModelField Name="Id" />
</Fields>
</ext:Model>
</Model>
<Parameters>
<ext:StoreParameter Mode="Raw" Name="Group" Value="#{ComboBoxTransferGroup}.getValue()" />
</Parameters>
</ext:Store>
</Store>
<DirectEvents>
<Select OnEvent="ComboBoxTransferGroupMembers_Select">
<ExtraParams>
<ext:Parameter Mode="Raw" Name="Group" Value="#{ComboBoxTransferGroup}.getValue()" />
</ExtraParams>
</Select>
</DirectEvents>
</ext:ComboBox>

Get elements of same name from XML using XQuery in SQL server

I am having following XML
DECLARE #ruleXML XML
SET #RuleXML = '<questionnaire xmlns:xsi="http://schema1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schem2" title="Sample">
<sections>
<section id="24" title="Section Title" help="" url="">
<questions />
</section>
<section id="23" title="Information" help="" url="">
<questions />
</section>
<section id="25" title="Section Title1" help="" url="">
<questions>
<question id="3" title="Question Text">
<display-rules />
<questions />
</question>
<question id="4" title="Question Text" >
<response-set type="inline" />
<display-rules />
<questions />
</question>
</questions>
</section>
</sections>
</questionnaire>'
How to get a table with question id and title from all the question nodes regardless of their level using XQUERY in SQL server?
; with xmlnamespaces (default 'http://schem2')
select tbl.col1.value('#id', 'int')
, tbl.col1.value('#title', 'varchar(100)')
from #RuleXML.nodes('//question') tbl(col1)
Working example at SQL FIddle.

ExtJs Set Parameters Values

I have a form with some controls (extJs and ASP) like this:
<ext:ComboBox ID="Countries" runat="server" .../>
<asp:CheckBox ID="cb1" runat="server" />
I want to send parameters using BaseParams of the store object:
<ext:Parameter Name="cid" Value="Ext.get('#{Countries}').getValue()" />
<ext:Parameter Name="cbv" Value="#{cb1}.dom.checked" />
and that became:
Ext.apply( options.params,{
"cid":Ext.get('CountryCities1_Countries').getValue(),
"cbv":Ext.get("CountryCities1_cb1").dom.checked}
);
as you see get the value from ASP.Net checkbox is simpler than extJs Combobox... Do you know other clean way to get the combobox value?
I found it... Just like this:
<ext:ComboBox ...>
<Listeners>
<Select Handler=" #{myStore}.reload({ params: {cid: this.value}});" />
</Listeners>
</ext:ComboBox>

Table tool in showing one fewer database records

the main concern is my query is running smoothly in SQL and also in table dataset query preview. i mean in table dataset query data preview it's displaying 2 records from my database table.
please find the screen shot.
also find Jrxml file.
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report2" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<style name="table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="Table Dataset 1">
<queryString>
<![CDATA[select lname, fname from test1
order by fname]]>
</queryString>
<field name="lname" class="java.lang.String"/>
<field name="fname" class="java.lang.String"/>
</subDataset>
<subDataset name="New Dataset 1">
<queryString language="SQL">
<![CDATA[select lname, fname from test1
order by fname]]>
</queryString>
<field name="lname" class="java.lang.String"/>
<field name="fname" class="java.lang.String"/>
</subDataset>
<queryString>
<![CDATA[select lname, fname from test1
order by fname]]>
</queryString>
<field name="lname" class="java.lang.String"/>
<field name="fname" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch"/>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="61" splitType="Stretch">
<staticText>
<reportElement x="100" y="41" width="102" height="20"/>
<textElement/>
<text><![CDATA[lname]]></text>
</staticText>
<staticText>
<reportElement x="202" y="41" width="147" height="20"/>
<textElement/>
<text><![CDATA[fname]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="125" splitType="Stretch">
<componentElement>
<reportElement key="table" style="table" x="100" y="0" width="360" height="86"/>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="Table Dataset 1">
<dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression>
</datasetRun>
<jr:column width="90">
<jr:detailCell style="table_TD" height="20" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{lname}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90">
<jr:detailCell style="table_TD" height="20" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{fname}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
but the output in pdf report is only 1 record which is last 1.
This is happening to me when using a JRBeanCollectionDataSource. I know for a fact that all the data is there but the table tool keeps missing the first row.
It looks like the main report executes a ".next()" on the collection or something then the subreport (a.k.a table) keeps on going with the rest of the data
Anyway, I solved it passing $P{REPORT_DATA_SOURCE}.cloneDataSource() as the dataSource expression of the table. Then it looks like the table starts with a brand new datasource and can iterate through all the items, and so, it works.
I don't know what datasource you are using but you have to figure out a way to move the cursor to the beginning of your data before using the subreport.
So, summing up, I did this in my jrxml file:
<dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}.cloneDataSource()]]></dataSourceExpression>
but Only because I am using a JRBeanCollectionDataSource
Exactly the same problem as kawda and exactly the same behavior than user1972796 : multiple tables instead of one, but correct number of rows in one table.
The problem seams to appear in cases where the master report doesn't iterate over anything and the subreport has been put into the Details Band and references the master data source via $P{REPORT_DATA_SOURCE}
The explanation (and solution) seams to be this one: http://community.jaspersoft.com/wiki/why-first-record-missing-my-subreport
Maybe you should use <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>instead <dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression>

Resources