Table tool in showing one fewer database records - database

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>

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>

Associate Feature to Checkbox in WiX

I have a few features (Complete, which has 2 child features, namely AppFeature and DBFeature) in my Product.wxs, as shown below.
<Feature InstallDefault="local" Description="!(loc.FullFeatureDesc)" Title="!(loc.FullFeatureTitle)" Level="1" Id="Complete" Absent="allow" AllowAdvertise="no" Display="expand">
<Feature InstallDefault="local" Description="!(loc.AppFeatureDesc)" Title="!(loc.AppFeatureTitle)" Level="1" Id="AppFeature" Absent="allow" AllowAdvertise="no" Display="expand">
<ComponentGroupRef Id="AppCG"/>
</Feature>
<Feature InstallDefault="local" Description="!(loc.DBFeatureDesc)" Title="!(loc.DBFeatureTitle)" Level="1" Id="DBFeature" Absent="allow" AllowAdvertise="no" Display="expand">
<ComponentGroupRef Id="DbCG"/>
</Feature>
</Feature>
In another dialog, I have a few checkboxes for All, App and DB options, each meant for a feature (All means both App and DB). I want to associate App checkbox to App
feature and DB checkbox to DB Feature. I tried it using Publish element in the Next button on that dialog using the Event="AddLocal" and Value="AppFeature" and one for DBFeature with the checkbox values checked appropriately. But on clicking on Next button, nothing happens. Can anyone please help me? I am also providing the elements on the dialog for reference.
<Control Id="ControlAllFeature" Type="CheckBox" X="180" Y="33" Width="140" Height="17"
Property="ALLFEATURES_CHECKED" CheckBoxValue="AllFeatureValue" Text="Install Everything">
<Publish Property="APPFEATURE_CHECKED" Value="AppFeatureValue" Order="1">ALLFEATURES_CHECKED</Publish>
<Publish Property="APPFEATURE_CHECKED" Value="{}" Order="2">NOT ALLFEATURES_CHECKED</Publish>
<Publish Property="DBFEATURE_CHECKED" Value="DBFeatureValue" Order="3">ALLFEATURES_CHECKED</Publish>
<Publish Property="DBFEATURE_CHECKED" Value="{}" Order="4">NOT ALLFEATURES_CHECKED</Publish>
</Control>
<Control Id="ControlAppFeature" Type="CheckBox" X="191" Y="50" Width="140" Height="17"
Property="APPFEATURE_CHECKED" CheckBoxValue="AppFeatureValue" Text="Install Application">
<Publish Property="ALLFEATURES_CHECKED" Value="{}" Order="1">NOT APPFEATURE_CHECKED</Publish>
<Publish Property="ALLFEATURES_CHECKED" Value="AllFeatureValue" Order="2">APPFEATURE_CHECKED AND DBFEATURE_CHECKED</Publish>
</Control>
<Control Id="ControlDBFeature" Type="CheckBox" X="191" Y="67" Width="140" Height="17"
Property="DBFEATURE_CHECKED" CheckBoxValue="DBFeatureValue" Text="Install DB">
<Publish Property="ALLFEATURES_CHECKED" Value="{}" Order="1">NOT DBFEATURE_CHECKED</Publish>
<Publish Property="ALLFEATURES_CHECKED" Value="AllFeatureValue" Order="2">APPFEATURE_CHECKED AND DBFEATURE_CHECKED</Publish>
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&Back">
<Publish Event="NewDialog" Value="CustLicenseAgmtDlg">1</Publish>
</Control>
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&Next">
<Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg">CostingComplete = 1</Publish>
<Publish Event="NewDialog" Value="BrowsePathDlg"></Publish>
<Condition Action="disable">NOT APPFEATURE_CHECKED OR NOT DBFEATURE_CHECKED</Condition>
<Condition Action="enable">APPFEATURE_CHECKED OR DBFEATURE_CHECKED</Condition>
<Publish Event="Remove" Value="ALL" Order="1">1</Publish>
<Publish Event="AddLocal" Value="AppFeature" Order="2">APPFEATURE_CHECKED</Publish>
<Publish Event="AddLocal" Value="DBFeature" Order="3">DBFEATURE_CHECKED</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
I referred the link below for this, but couldn't get it working. Any help will be really appreciated.
Wix 3.5, Install features based on checkboxes
I changed the approach. There are actually 2 ways. One is to do it in Product.wxs within the feature elements to have a condition. The other one gives better control. The mark up below explains it.
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&Next">
<Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg">CostingComplete = 1</Publish>
<Publish Event="NewDialog" Value="BrowsePathDlg">1</Publish>
<Condition Action="disable">NOT APPFEATURE_CHECKED OR NOT DBFEATURE_CHECKED OR (((!AppFeature = 3) AND (!DBFeature = 2) AND NOT DBFEATURE_CHECKED) AND ((!DBFeature = 3) AND (!AppFeature = 2) AND NOT APPFEATURE_CHECKED)) OR ((!AppFeature = 3) AND (!DBFeature = 3))</Condition>
<Condition Action="enable">(APPFEATURE_CHECKED OR DBFEATURE_CHECKED) AND (((!AppFeature = 2) AND APPFEATURE_CHECKED) OR ((!DBFeature = 2) AND DBFEATURE_CHECKED))</Condition>
<Publish Event="AddLocal" Value="ALL">1</Publish>
<Publish Event="Remove" Value="AppFeature"><![CDATA[APPFEATURE_CHECKED <> "1"]]></Publish>
<Publish Event="Remove" Value="DBFeature"><![CDATA[DBFEATURE_CHECKED <> "1"]]></Publish>
</Control>
What I was missing earlier was the value of 1 in the Publish NewDialog event. Once I added it, it started working and clicking on the Next button, took me to the next dialog.
Try this:
in your chield feature put it in level 0, and them put a condition inside her to validate if the checkbox was checked
<Feature InstallDefault="local" Description="!(loc.FullFeatureDesc)" Title="!(loc.FullFeatureTitle)" Level="1" Id="Complete" Absent="allow" AllowAdvertise="no" Display="expand">
<Feature InstallDefault="local" Description="!(loc.AppFeatureDesc)" Title="!(loc.AppFeatureTitle)" Level="0" Id="AppFeature" Absent="allow" AllowAdvertise="no" Display="expand">
<ComponentGroupRef Id="AppCG"/><Condition Level="1">APPFEATURE_CHECKED</Condition>
</Feature>
<Feature InstallDefault="local" Description="!(loc.DBFeatureDesc)" Title="!(loc.DBFeatureTitle)" Level="1" Id="DBFeature" Absent="allow" AllowAdvertise="no" Display="expand">
<ComponentGroupRef Id="DbCG"/>
</Feature>
</Feature>

Integrating Flex 4.6 and Coldfusion

I'm having some challenges with getting my Flex front-end form to pass its data into Coldfusion and subsequently SQL Server. Here is my code below:
MXML:
<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="764" height="434"
width.State1="630" creationComplete="initApp()">
<fx:Style>
#namespace s "library://ns.adobe.com/flex/spark";
s|Form#form1 s|FormItem
{
skinClass: ClassReference("spark.skins.spark.FormItemSkin");
}
s|Form#form1 s|FormHeading
{
skinClass: ClassReference("spark.skins.spark.FormHeadingSkin");
}
s|Form#form1
{
skinClass: ClassReference("spark.skins.spark.FormSkin");
}
</fx:Style>
<fx:Script>
<![CDATA[
import assets.*;
import assets.comps.accountManagement.userLogin;
import assets.comps.accountManagement.userRegistration;
import model.*;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.events.ValidationResultEvent;
import mx.managers.PopUpManager;
import mx.rpc.events.*;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.utils.ObjectUtil;
import vo.*;
//public var cfcResponse:String;
//this gets called when the application is done being created
//
[Bindable]
private function initApp():void{
//this calls the confirmCFC method in remoting.cfc
//cfc_ro.confirmCFC(); }
//Result Event Method maps RO call to Result Event
//public function loadConfirm(event:ResultEvent):void{
//this binds the cfcResponse var to the result of the RO call
//cfcResponse = event.result as String;
}
//Method submits registration information to the DB via the controller Registration.cfc
//Upon Successful registration, user receives a confirmation of their successful
registration.
protected function createUser():void
{
userRegistrationRO.userRegMethod(
fName.text,
lName.text,
uName.text,
password.text,
city.text,
state.name,
zip.text,
email.text,
DOB.name,
secQuestion1.name,
secQuestion2.name,
ans1.text,
ans2.text);
}
//Method initiated on the Reset button click and clears form fields
private function _resetForm():void
{
fName.text = "";
lName.text = "";
uName.text = "";
password.text = ""
city.text = "";
state.selectedIndex -1;
email.text = "";
confirm_email.text = "";
}
//Result event for registration
private function registrationResultEvent(event:ResultEvent):void{
}
//Fault handler for userRegMethod function
private function registrationFaultHandler(event:FaultEvent):void{
Alert.show("Your attempt to register was unsuccessful. Please try again. If problem
persists, contact Administrator")
}
//Registration RO Event Handler
private function regROHandler(event):void{
Alert.show("RO connection successful");
}
//Registration RO Fault Handler
private function regROFaultHandler(event:FaultEvent):void{
Alert.show("Error 100: Remote object call unsuccessful. Unable to submit data. Please
contact Administrator at support#blackiceems.com");
}
//variable references user registration popup
private var userRegForm:userRegistration;
//Registration Event Handler. Notifies user of successful registration by displaying a
confirmation message.
private function regHandler(event:Event):void
{ Alert.show("Registration Successful!");
PopUpManager.removePopUp(userRegForm); }
//This funtion calls user reg. form
private function showRegForm():void {
//This variable calls the Login Title Windows
//var userRegForm:userRegistration = new userRegistration as IFlexDisplayObject =
userRegForm = new userRegistration();
userRegForm.addEventListener(Event.CLOSE, closeHandler);
userRegForm.addEventListener("register", regHandler);
userRegForm.addEventListener("cancel", closeHandler);
PopUpManager.addPopUp(userRegForm, this, true);
PopUpManager.centerPopUp(userRegForm);
//userRegForm.setInitialFocus();
}
//Close Registration Event Handler
private function closeHandler(event):void
{Alert.show("You cancelled the login operation", "Login Cancelled");
PopUpManager.removePopUp(userRegForm);
}
]]>
</fx:Script>
</s:RemoteObject>-->
<!--End of Transitions Code Block-->
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<!--This remote object passes form data from the form into the CFC DAO. Data Validates on client and server side.-->
<!-- Defines the data model for the form. -->
<!--<fx:Model id="formInfo">
<formData>
<date>
<month>{monthInput.text}</month>
<day>{dayInput.text}</day>
<year>{yearInput.text}</year>
</date>
<name>
<firstName>{fNameInput.text}</firstName>
<lastName>{lNameInput.text}</lastName>
</name>
<phoneNum>{phoneInput.text}</phoneNum>
</formData>
</fx:Model>-->
<!-- Define the validators. -->
<mx:StringValidator id="fNameValidator"
required="true"
source="{fName}"
property="text"
minLength="3"
maxLength="10"
tooShortError="Your entry is too short to be a valid last name."
tooLongError="Your entry is too long to be a valid first name."/>
<mx:StringValidator id="lNameValidator"
required="true"
source="{lName}"
property="text"
minLength="2"
maxLength="12"
tooShortError="Your entry is too short to be a valid last name."
tooLongError="Your entry is too long for a last name."/>
<mx:StringValidator id="cityValidator"
required="true"
source="{city}"
property="text"
minLength="4"
maxLength="15"
tooShortError="Your city name is too short to be valid"/>
<mx:StringValidator id="stateValidator"
required="true"
source="{state}"
property="text"/>
<mx:ZipCodeValidator id="zipcodeValidator"
required="true"
source="{zip}"
property="text" />
<mx:StringValidator id="emailValidator"
required="true"
source="{email}"
property="text"
tooLongError="Your email address exceeded the maximum length allowed."
tooShortError="Your email address is too short to be a valid email address."/>
<mx:StringValidator id="confirm_emailValidator"
required="true"
source="{confirm_email}"
property="text"/>
<mx:StringValidator id="userNameValidator"
required="true"
source="{uName}"
property="text"
minLength="6"
maxLength="15"
tooShortError="Your username must be a minimum of 6 alphanumeric characters."
tooLongError="Your username is too long. Usernames must not exceed 15 alphanumberic characters."/>
</fx:Declarations>
<!--Form Layout Elements and text fields contained below-->
<s:TitleWindow height="100%" close="PopUpManager.removePopUp(this);" controlBarVisible="true"
title="New Member Registration"
width.p2="100%"
width.State1="100%">
<s:controlBarContent>
<s:Button label="Register"
click.p2="createUser();" enabled.p2="true"
click.State1="createUser();" enabled.State1="true"/>
<s:Button label="Reset"
click.State1="_resetForm();showRegForm();"/>
</s:controlBarContent>
<s:layout.State1>
<s:ConstraintLayout/>
</s:layout.State1>
<!--Form Starts Here-->
<s:Form id="RegForm" width="100%" height="90%" skinClass="spark.skins.spark.FormSkin">
<s:SkinnableContainer width="100%" height="350">
<s:FormItem id="f_Name" includeIn="State1" label="First Name">
<s:TextInput id="fName" width="100%" displayAsPassword="false" tabEnabled="true"
tabFocusEnabled="true" tabIndex="0"/>
</s:FormItem>
<s:FormItem id="l_Name" includeIn="State1" x="230" label="Last Name">
<s:TextInput id="lName" tabEnabled="true" tabFocusEnabled="true" tabIndex="1"/>
</s:FormItem>
<s:FormItem id="frm_city" includeIn="State1" x="0" y="53" label="City">
<s:TextInput id="city" tabIndex="2"/>
</s:FormItem>
<s:FormItem id="frm_zip" includeIn="State1" x="371" y="59" width="165"
label="Zip Code">
<s:TextInput id="zip" width="77"/>
</s:FormItem>
<s:FormItem id="frm_state" includeIn="State1" x="206" y="55" width="157" height="41"
label="State">
<s:DropDownList id="state" width="100" prompt="Select Date" selectedIndex="-1">
<s:dataProvider>
<s:ArrayList>
<fx:String> Alabama</fx:String>
<fx:String> Alaska</fx:String>
<fx:String> California</fx:String>
<fx:String> Colorado</fx:String>
<fx:String> Conneticut</fx:String>
</s:ArrayList>
</s:dataProvider>
</s:DropDownList>
</s:FormItem>
<s:FormItem id="frm_email" includeIn="State1" x="0" y="100" width="214" label="Email">
<s:TextInput id="email" width="152"/>
</s:FormItem>
<s:FormItem id="frm_cfirm_email" includeIn="State1" x="257" y="100" width="279"
label="Confirm Email">
<s:TextInput id="confirm_email" width="152"/>
</s:FormItem>
<s:FormItem id="frm_username" includeIn="State1" x="1" y="142" width="213"
label="Username">
<s:TextInput id="uName"/>
</s:FormItem>
<s:FormItem id="frm_password" includeIn="State1" x="3" y="191" width="215"
label="Password">
<s:TextInput id="password" displayAsPassword="true"/>
</s:FormItem>
<s:Button x="0" y="326" label=">> Next"
x.p2="0" y.p2="328" width.p2="96" label.p2="<< Previous"
click.p2="currentState='State1'"
x.State1="0" y.State1="328" click.State1="currentState='p2';initApp();"/>
<s:FormItem includeIn="p2" x="1" y="10" width="644" label="Security Question 1:">
<s:DropDownList id="secQuestion1" width="409" mouseEnabled="false">
<s:dataProvider>
<s:ArrayList>
<fx:String> What was your high school mascot?</fx:String>
<fx:String> What is your mother's maiden Name?</fx:String>
<fx:String> What was your first car?</fx:String>
</s:ArrayList>
</s:dataProvider>
</s:DropDownList>
</s:FormItem>
<s:FormItem includeIn="p2" x="1" y="108" width="644" label="Security Question 2:">
<s:DropDownList id="secQuestion2" width="409" mouseEnabled="false">
<s:dataProvider>
<s:ArrayList>
<fx:String> Who was your best friend growing up? </fx:String>
<fx:String> What city were you born in? </fx:String>
<fx:String> What was your first car?</fx:String>
</s:ArrayList>
</s:dataProvider>
</s:DropDownList>
</s:FormItem>
<s:FormItem includeIn="p2" x="64" y="58" width="254" label="Answer 1">
<s:TextInput id="ans1" width="160"/>
</s:FormItem>
<s:FormItem includeIn="p2" x="359" y="59" width="286" label="Confirm Answer">
<s:TextInput width="160"/>
</s:FormItem>
<s:FormItem includeIn="p2" x="64" y="159" width="254" label="Answer 1">
<s:TextInput id="ans2" width="160"/>
</s:FormItem>
<s:FormItem includeIn="p2" x="359" y="160" width="286" label="Confirm Answer">
<s:TextInput width="160"/>
</s:FormItem>
<s:FormItem id="frm_DOB" includeIn="State1" x="257" y="153" label="D.O.B.">
<mx:DateChooser id="DOB" x="183" y="288" width="189" height="146"/>
</s:FormItem>
<!--This label displays value of cfcResponse variable when Front-end to CFC remote object call is successful-->
<!--<s:Label includeIn="State1" x="0" y="240" width="171" height="40" color="#F6F309"
text="{cfcResponse}"/>-->
</s:SkinnableContainer>
</s:Form>
</s:TitleWindow>
Coldfusion CFC:
<cffunction name="init" access="public" output="false" returntype="any">
<cfargument name="DSN" required="true" type="string" hint="datasource" />
<cfset variables.DSN = arguments.DSN />
<cfreturn this />
</cffunction>
<!---Flex app CFC Remoting test function--->
<cffunction name="confirmCFC" access="remote"
returntype="any"
description="tests the remote object communication between View the controller code" >
<cfreturn "Your Flex Remoting with this CFC is successful."/>
</cffunction>
<!---User Registraton--->
<!---Function pulls form values from flex form via Remote Object Call--->
<cffunction name="userRegMethod" access="remote" output="false" returntype="any">
<cfargument name="fName" type="string" >
<cfargument name="lName" type="string">
<cfargument name="uName" type="string" >
<cfargument name="password" type="string">
<cfargument name="city" type="string">
<cfargument name="state" type="any" default="CA">
<cfargument name="zip" type="string">
<cfargument name="email" type="string">
<cfargument name="dob" type="any" default="05/20/1982">
<cfargument name="secQuestion1" type="any" default="Mother's maiden name">
<cfargument name="secQuestion2" type="any" default="What's your high school mascot?">
<cfargument name="ans1" type="string" default="Maxine">
<cfargument name="ans2" type="string" default="Tigers">
<!---Query Checks for Existing User In DB--->
<cfquery name="qryUserExistence" datasource="blackiceDS">
select email,userName
from tblUserAccount
where email = <cfqueryparam value="#argument.email#" cfsqltype="cf_sql_varchar">
OR uName = <cfqueryparam value="#argument.uName#" cfsqltype="cf_sql_varchar">
</cfquery>
<!---If No User found by email, record count set to 0--->
<cfif qryUserExistence.RecordCount eq 0 >
<!---New User is then created in the table--->
<cfquery name="qryCreateUser" datasource="BlackIceDS">
INSERT INTO [dbo].tblUserAccount (fName,lName,uName,password, city, state, zip, email, dob,secQuestion1, secQuestion2, ans1, ans2)
VALUES (<cfqueryparam value="#fName#" cfsqltype="cf_sql_varchar">,
<cfqueryparam value="#lName#" cfsqltype="cf_sql_varchar">,
<cfqueryparam value="#uName#" cfsqltype="cf_sql_varchar">,
<cfqueryparam value="#password#" cfsqltype="cf_sql_varchar">,
<cfqueryparam value="#city#" cfsqltype="cf_sql_varchar">,
<cfqueryparam value="#state#" cfsqltype="cf_sql_varchar">,
<cfqueryparam value="#zip#" cfsqltype="cf_sql_varchar">,
<cfqueryparam value="#email#" cfsqltype="cf_sql_varchar">,
<cfqueryparam value="#dob#" cfsqltype="cf_sql_varchar">,
<cfqueryparam value="#secQuestion1#" cfsqltype="cf_sqlvarchar">,
<cfqueryparam value="#secQuestion2#" cfsqltype="cf_sql_varchar">,
<cfqueryparam value="#ans1#" cfsqltype="cf_sql_varchar">,
<cfqueryparam value="#ans2#" cfsqltype="cf_sql_varchar">)
</cfquery>
<!---Upon creation of new user account, user is returned a verification welcome message--->
<cfelse>`enter code here`
<!---Otherwise if an existing account is discovered, user is informed of the
existing account and asked to select a different username and password--->
<cfreturn "An existing account was found with the selected username and/or
password. Please select a different email address."/>
</cfif>
</cffunction>
<!---End of User Registraton Functions--->
</cffunction>
My form has a date picker. How can I pass the selected date back to the CFC? When I try I get a Coldfusion error that the flex value is not of type date so I went to varchar as the value type and I still get an error. I'm trying to resolve this issue so my remote object call between Flex and CF verifies it works. I've included my preliminary code. Any thoughts would be appreciated.
If you are sending the date from flex to Coldfusion as a String then define dob as a String in Coldfusion:
<cfargument name="dob" type="string">
When you call the remote function, I see you are passing DOB.name. Convert DOB.selectedDate to String. You can use getDOBString(DOB.selectedDate)
You can define the function as below:
private function getDOBString(date:Date):String{
var df:DateFormatter = new DateFormatter();
df.formatString = "MM/DD/YYYY";
var dateString:String = df.format(date);
return dateString;
}

How to work in Crystal Report with Object Data Source?

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>

Resources