I need to return all XML nodes whose ID attributes match between <Settings></Settings> and <Profile></Profile> and whose <Setting/> node has a Value attribute of true.
An example of my XML structure is found below:
<HBDI>
<Settings>
<Setting ID="PreferenceCode" Visible="true"/>
<Setting ID="SequenceCode" Visible="true"/>
<Setting ID="QuadrantScores" Visible="false"/>
<Setting ID="AdjectivePairs" Visible="false"/>
<Setting ID="ModeScores" Visible="true"/>
<Setting ID="Graph" Visible="true"/>
</Settings>
<Profile>
<PreferenceCode ID="PreferenceCode">3332</PreferenceCode>
<SequenceCode ID="SequenceCode">DCAB</SequenceCode>
<Graph ID="Graph">Graph.jpg</Graph>
<QuadrantScores ID="QuadrantScores">
<QuadrantScore Name="A" Value="3" />
<QuadrantScore Name="B" Value="3" />
<QuadrantScore Name="C" Value="23" />
<QuadrantScore Name="D" Value="46" />
</QuadrantScores>
<AdjectivePairs ID="AdjectivePairs">
<AdjectivePair Name="A" Value="4" />
<AdjectivePair Name="B" Value="7" />
<AdjectivePair Name="C" Value="9" />
<AdjectivePair Name="D" Value="10" />
</AdjectivePairs>
<ModeScores ID="ModeScores">
<ModeScore Name="Lt" Value="34" />
<ModeScore Name="Rt" Value="54" />
<ModeScore Name="Upr" Value="3" />
<ModeScore Name="Lwr" Value="24" />
</ModeScores>
</Profile>
</HBDI>
So what I want to achieve is to retrieve the following xml:
<HBDI>
<PreferenceCode ID="PreferenceCode">3332</PreferenceCode>
<SequenceCode ID="SequenceCode">DCAB</SequenceCode>
<Graph ID="Graph">Graph.jpg</Graph>
<ModeScores ID="ModeScores">
<ModeScore Name="Lt" Value="34" />
<ModeScore Name="Rt" Value="54" />
<ModeScore Name="Upr" Value="3" />
<ModeScore Name="Lwr" Value="24" />
</ModeScores>
</HBDI>
So, in the case of ID="PreferenceCode", it's corresponding Visible attribute in <Settings/> is true, thus it needs to be returned. I must admit that I have no idea on how to do the match-up between the IDs. Any help please?
When you are dealing with XML, use XQuery:
DECLARE #MyXML xml = '
<HBDI>
<Settings>
<Setting ID="PreferenceCode" Visible="true"/>
<Setting ID="SequenceCode" Visible="true"/>
<Setting ID="QuadrantScores" Visible="false"/>
<Setting ID="AdjectivePairs" Visible="false"/>
<Setting ID="ModeScores" Visible="true"/>
<Setting ID="Graph" Visible="true"/>
</Settings>
<Profile>
<PreferenceCode ID="PreferenceCode">3332</PreferenceCode>
<SequenceCode ID="SequenceCode">DCAB</SequenceCode>
<Graph ID="Graph">Graph.jpg</Graph>
<QuadrantScores ID="QuadrantScores">
<QuadrantScore Name="A" Value="3" />
<QuadrantScore Name="B" Value="3" />
<QuadrantScore Name="C" Value="23" />
<QuadrantScore Name="D" Value="46" />
</QuadrantScores>
<AdjectivePairs ID="AdjectivePairs">
<AdjectivePair Name="A" Value="4" />
<AdjectivePair Name="B" Value="7" />
<AdjectivePair Name="C" Value="9" />
<AdjectivePair Name="D" Value="10" />
</AdjectivePairs>
<ModeScores ID="ModeScores">
<ModeScore Name="Lt" Value="34" />
<ModeScore Name="Rt" Value="54" />
<ModeScore Name="Upr" Value="3" />
<ModeScore Name="Lwr" Value="24" />
</ModeScores>
</Profile>
</HBDI>'
SELECT #MyXML.query('
<HDBI> {
let $settings := /HBDI/Settings
for $element in /HBDI/Profile/*
where $settings/Setting[#ID = local-name($element) and #Visible = "true"]
return $element
} </HDBI>
')
The XQuery loops through each child node of the <Profile> tag and check if it's set to #Visible = "true" in the <Settings> node. local-name() gives the name of the current node.
Related
The code after automatic formatting with Ctrl + Alt + L looks like this:
class ExampleModel extends Model
{
public $timestamps = false;
protected $table = 'table1';
protected $primaryKey = 'id';
protected $casts
= [ //array declaration is on a newline!
'id' => 'int',
'aa' => 'int',
'bb' => 'int',
'cc' => 'int',
];
protected $fillable
= [ //array declaration is on a newline!
'id',
'aa',
'bb',
'cc',
];
}
But I would like PhpStorm to let it be / keep on the same line:
class ExampleModel extends Model
{
public $timestamps = false;
protected $table = 'table1';
protected $primaryKey = 'id';
protected $casts = [
'id' => 'int',
'aa' => 'int',
'bb' => 'int',
'cc' => 'int',
];
protected $fillable = [
'id',
'aa',
'bb',
'cc',
];
}
I thought it was under Editor > Code Style > PHP > Array initializer but nothing seems to work.
attachment (link)
<code_scheme name="PSR-2" version="173">
<option name="AUTODETECT_INDENTS" value="false" />
<option name="LINE_SEPARATOR" value="
" />
<option name="RIGHT_MARGIN" value="500" />
<option name="SOFT_MARGINS" value="100" />
<HTMLCodeStyleSettings>
<option name="HTML_KEEP_BLANK_LINES" value="1" />
</HTMLCodeStyleSettings>
<JSCodeStyleSettings>
<option name="FORCE_SEMICOLON_STYLE" value="true" />
<option name="SPACE_BEFORE_GENERATOR_MULT" value="true" />
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
<option name="USE_DOUBLE_QUOTES" value="false" />
<option name="FORCE_QUOTE_STYlE" value="true" />
<option name="SPACES_WITHIN_IMPORTS" value="true" />
</JSCodeStyleSettings>
<PHPCodeStyleSettings>
<option name="ALIGN_KEY_VALUE_PAIRS" value="true" />
<option name="ALIGN_PHPDOC_PARAM_NAMES" value="true" />
<option name="ALIGN_PHPDOC_COMMENTS" value="true" />
<option name="COMMA_AFTER_LAST_ARRAY_ELEMENT" value="true" />
<option name="PHPDOC_BLANK_LINE_BEFORE_TAGS" value="true" />
<option name="PHPDOC_BLANK_LINES_AROUND_PARAMETERS" value="true" />
<option name="GROUP_USE_WRAP" value="0" />
<option name="LOWER_CASE_BOOLEAN_CONST" value="true" />
<option name="LOWER_CASE_NULL_CONST" value="true" />
<option name="ELSE_IF_STYLE" value="COMBINE" />
<option name="BLANK_LINES_BEFORE_RETURN_STATEMENT" value="1" />
<option name="KEEP_RPAREN_AND_LBRACE_ON_ONE_LINE" value="true" />
<option name="FORCE_SHORT_DECLARATION_ARRAY_STYLE" value="true" />
<option name="IF_RPAREN_ON_NEXT_LINE" value="true" />
</PHPCodeStyleSettings>
<codeStyleSettings language="HTML">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JavaScript">
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
<option name="SPACE_BEFORE_METHOD_PARENTHESES" value="true" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="KEEP_SIMPLE_BLOCKS_IN_ONE_LINE" value="true" />
<option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="true" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="PHP">
<option name="RIGHT_MARGIN" value="999" />
<option name="KEEP_LINE_BREAKS" value="false" />
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
<option name="BLANK_LINES_AFTER_PACKAGE" value="1" />
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="ALIGN_MULTILINE_FOR" value="false" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
<option name="METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
<option name="METHOD_CALL_CHAIN_WRAP" value="2" />
<option name="BINARY_OPERATION_WRAP" value="1" />
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
<option name="TERNARY_OPERATION_WRAP" value="1" />
<option name="FOR_STATEMENT_WRAP" value="1" />
<option name="FOR_STATEMENT_LPAREN_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_RPAREN_ON_NEXT_LINE" value="true" />
<option name="ARRAY_INITIALIZER_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE" value="true" />
<option name="ARRAY_INITIALIZER_RBRACE_ON_NEXT_LINE" value="true" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="PLACE_ASSIGNMENT_SIGN_ON_NEXT_LINE" value="true" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="WHILE_BRACE_FORCE" value="3" />
<option name="FOR_BRACE_FORCE" value="3" />
<option name="SOFT_MARGINS" value="100" />
</codeStyleSettings>
<codeStyleSettings language="SCSS">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="Twig">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
Settings/Preferences
Editor | Code Style | PHP
Wrapping and Braces tab
You have checked Assignment statement | Assignment sign on next line option. Uncheck it to have desired formatting.
I've read a fair amount on this issue but nothing seems to be working.
So far I have made sure that the StoreGeneratedPattern Identity is on two tables. I checked the model AND store. Both have the property set. However, when I insert into these tables, both ids are '0'.
I hope that someone familiar with these issues can take a look and tell me where I've got it wrong
Thanks
Here is the generated xml (irrelevant tables removed):
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
<!-- EF Runtime content -->
<edmx:Runtime>
<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="rule_testModel.Store" Provider="MySql.Data.MySqlClient" ProviderManifestToken="5.7" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
<Key>
<PropertyRef Name="RateId" />
<PropertyRef Name="RateTypeId" />
<PropertyRef Name="PaymentPlanId" />
<PropertyRef Name="TariffDescriptionId" />
<PropertyRef Name="FeatureId" />
<PropertyRef Name="FuelId" />
<PropertyRef Name="Live" />
</Key>
<Property Name="RateId" Type="uint" Nullable="false" />
<Property Name="Profile" Type="uint" />
<Property Name="REC" Type="varchar" MaxLength="10" />
<Property Name="PlanName" Type="varchar" MaxLength="300" />
<Property Name="RateTypeId" Type="uint" Nullable="false" />
<Property Name="PaymentPlanId" Type="uint" Nullable="false" />
<Property Name="Product" Type="varchar" MaxLength="45" />
<Property Name="ContractDuration" Type="varchar" MaxLength="45" />
<Property Name="TariffDescriptionId" Type="uint" Nullable="false" />
<Property Name="TariffUnrestricted" Type="decimal" Precision="6" Scale="3" />
<Property Name="TariffDay" Type="decimal" Precision="6" Scale="3" />
<Property Name="TariffNight" Type="decimal" Precision="6" Scale="3" />
<Property Name="TariffEveningWeekend" Type="decimal" Precision="6" Scale="3" />
<Property Name="StandingChargePenceDay" Type="decimal" Precision="6" Scale="3" />
<Property Name="StandingChargeGBPQuarter" Type="decimal" Precision="6" Scale="3" />
<Property Name="StandingChargeGBPMonth" Type="decimal" Precision="6" Scale="3" />
<Property Name="StandingChargeGBPYear" Type="decimal" Precision="6" Scale="3" />
<Property Name="CapacityCharge" Type="decimal" Precision="7" Scale="3" />
<Property Name="FeatureId" Type="uint" Nullable="false" />
<Property Name="FromCon" Type="uint" />
<Property Name="ToCon" Type="uint" />
<Property Name="Version" Type="varchar" MaxLength="45" />
<Property Name="PriceType" Type="varchar" MaxLength="45" />
<Property Name="Duration" Type="uint" />
<Property Name="SupplierId" Type="uint" />
<Property Name="FuelId" Type="uint" Nullable="false" />
<Property Name="ProposedStartDate" Type="date" />
<Property Name="SignWindow" Type="uint" />
<Property Name="DateAdded" Type="datetime" Precision="0" StoreGeneratedPattern="Identity" />
<Property Name="Live" Type="uint" Nullable="false" />
<Property Name="MaxRate" Type="decimal" Precision="6" Scale="3" />
<Property Name="MaxSc" Type="decimal" Precision="6" Scale="3" />
<Property Name="UpStep" Type="decimal" Precision="6" Scale="3" />
</EntityType>
<EntityType Name="conditions">
<Key>
<PropertyRef Name="ConditionId" />
</Key>
<Property Name="ConditionId" Type="uint" Nullable="false" StoreGeneratedPattern="Identity" />
<Property Name="ProductId" Type="uint" Nullable="false" />
<Property Name="Profile" Type="usmallint" />
<Property Name="REC" Type="varchar" MaxLength="10" />
<Property Name="RateTypeId" Type="uint" />
<Property Name="PaymentPlanId" Type="uint" />
<Property Name="FeatureId" Type="uint" />
<Property Name="FromCon" Type="uint" />
<Property Name="ToCon" Type="uint" />
<Property Name="Duration" Type="uint" />
<Property Name="SupplierId" Type="uint" />
<Property Name="FuelId" Type="uint" />
<Property Name="live" Type="bool" />
<Property Name="TempRateId" Type="uint" />
</EntityType>
<EntityType Name="products">
<Key>
<PropertyRef Name="ProductId" />
</Key>
<Property Name="ProductId" Type="uint" Nullable="false" StoreGeneratedPattern="Identity" />
<Property Name="RateId" Type="uint" />
<Property Name="FromProductId" Type="uint" />
<Property Name="ServiceRef" Type="uint" />
<Property Name="UpCom" Type="decimal" Precision="6" Scale="3" />
<Property Name="UpSC" Type="decimal" Precision="6" Scale="3" />
<Property Name="FixedCom" Type="decimal" Precision="8" Scale="3" />
<Property Name="Live" Type="bool" Nullable="false" />
<Property Name="BrokerId" Type="uint" />
<Property Name="MaxRate" Type="decimal" Precision="6" Scale="3" />
<Property Name="MaxSC" Type="decimal" Precision="6" Scale="3" />
<Property Name="Step" Type="decimal" Precision="6" Scale="3" />
<Property Name="Fits" Type="decimal" Precision="6" Scale="3" />
<Property Name="Disc" Type="decimal" Precision="6" Scale="3" />
<Property Name="UpliftTypeId" Type="uint" Nullable="false" />
<Property Name="SupplierId" Type="uint" Nullable="false" />
<Property Name="FromCon" Type="uint" />
<Property Name="ToCon" Type="uint" />
</EntityType>
<Key>
<PropertyRef Name="word_id" />
</Key>
<Property Name="word_id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
<Property Name="word_context" Type="varchar" MaxLength="45" Nullable="false" />
<Property Name="word_word" Type="varchar" MaxLength="255" Nullable="false" />
</EntityType>
<EntityContainer Name="rule_testModelStoreContainer">
<EntitySet Name="conditions" EntityType="Self.conditions" Schema="rule_test" store:Type="Tables" />
<EntitySet Name="products" EntityType="Self.products" Schema="rule_test" store:Type="Tables" />
</EntityContainer>
</Schema></edmx:StorageModels>
<!-- CSDL content -->
<edmx:ConceptualModels>
<Schema Namespace="rule_testModel" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityContainer Name="eBroker2Entities" annotation:LazyLoadingEnabled="true">
<EntitySet Name="products" EntityType="rule_testModel.product" />
<EntitySet Name="conditions" EntityType="rule_testModel.condition" />
</EntityContainer>
<EntityType Name="product">
<Key>
<PropertyRef Name="ProductId" />
</Key>
<Property Name="ProductId" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="RateId" Type="Int32" />
<Property Name="FromProductId" Type="Int32" />
<Property Name="ServiceRef" Type="Int32" />
<Property Name="UpCom" Type="Decimal" />
<Property Name="UpSC" Type="Decimal" />
<Property Name="FixedCom" Type="Decimal" />
<Property Name="Live" Type="Boolean" Nullable="false" />
<Property Name="BrokerId" Type="Int32" />
<Property Name="MaxRate" Type="Decimal" />
<Property Name="MaxSC" Type="Decimal" />
<Property Name="Step" Type="Decimal" />
<Property Name="Fits" Type="Decimal" />
<Property Name="Disc" Type="Decimal" />
<Property Name="UpliftTypeId" Type="Int32" Nullable="false" />
<Property Name="SupplierId" Type="Int32" Nullable="false" />
<Property Name="FromCon" Type="Int32" />
<Property Name="ToCon" Type="Int32" />
</EntityType>
<EntityType Name="condition">
<Key>
<PropertyRef Name="ConditionId" />
</Key>
<Property Name="ConditionId" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
<Property Name="ProductId" Type="Int32" Nullable="false" />
<Property Name="Profile" Type="Int32" />
<Property Name="REC" Type="String" MaxLength="10" FixedLength="false" Unicode="false" />
<Property Name="RateTypeId" Type="Int32" />
<Property Name="PaymentPlanId" Type="Int32" />
<Property Name="FeatureId" Type="Int32" />
<Property Name="FromCon" Type="Int32" />
<Property Name="ToCon" Type="Int32" />
<Property Name="Duration" Type="Int32" />
<Property Name="SupplierId" Type="Int32" />
<Property Name="FuelId" Type="Int32" />
<Property Name="live" Type="Boolean" />
<Property Name="TempRateId" Type="Int32" />
</EntityType>
</Schema>
</edmx:ConceptualModels>
<!-- C-S mapping content -->
<edmx:Mappings>
<Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
<EntityContainerMapping StorageEntityContainer="rule_testModelStoreContainer" CdmEntityContainer="eBroker2Entities">
<EntitySetMapping Name="products">
<EntityTypeMapping TypeName="rule_testModel.product">
<MappingFragment StoreEntitySet="products">
<ScalarProperty Name="ToCon" ColumnName="ToCon" />
<ScalarProperty Name="FromCon" ColumnName="FromCon" />
<ScalarProperty Name="SupplierId" ColumnName="SupplierId" />
<ScalarProperty Name="UpliftTypeId" ColumnName="UpliftTypeId" />
<ScalarProperty Name="Disc" ColumnName="Disc" />
<ScalarProperty Name="Fits" ColumnName="Fits" />
<ScalarProperty Name="Step" ColumnName="Step" />
<ScalarProperty Name="MaxSC" ColumnName="MaxSC" />
<ScalarProperty Name="MaxRate" ColumnName="MaxRate" />
<ScalarProperty Name="BrokerId" ColumnName="BrokerId" />
<ScalarProperty Name="Live" ColumnName="Live" />
<ScalarProperty Name="FixedCom" ColumnName="FixedCom" />
<ScalarProperty Name="UpSC" ColumnName="UpSC" />
<ScalarProperty Name="UpCom" ColumnName="UpCom" />
<ScalarProperty Name="ServiceRef" ColumnName="ServiceRef" />
<ScalarProperty Name="FromProductId" ColumnName="FromProductId" />
<ScalarProperty Name="RateId" ColumnName="RateId" />
<ScalarProperty Name="ProductId" ColumnName="ProductId" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="conditions">
<EntityTypeMapping TypeName="rule_testModel.condition">
<MappingFragment StoreEntitySet="conditions">
<ScalarProperty Name="TempRateId" ColumnName="TempRateId" />
<ScalarProperty Name="live" ColumnName="live" />
<ScalarProperty Name="FuelId" ColumnName="FuelId" />
<ScalarProperty Name="SupplierId" ColumnName="SupplierId" />
<ScalarProperty Name="Duration" ColumnName="Duration" />
<ScalarProperty Name="ToCon" ColumnName="ToCon" />
<ScalarProperty Name="FromCon" ColumnName="FromCon" />
<ScalarProperty Name="FeatureId" ColumnName="FeatureId" />
<ScalarProperty Name="PaymentPlanId" ColumnName="PaymentPlanId" />
<ScalarProperty Name="RateTypeId" ColumnName="RateTypeId" />
<ScalarProperty Name="REC" ColumnName="REC" />
<ScalarProperty Name="Profile" ColumnName="Profile" />
<ScalarProperty Name="ProductId" ColumnName="ProductId" />
<ScalarProperty Name="ConditionId" ColumnName="ConditionId" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
</EntityContainerMapping>
</Mapping>
</edmx:Mappings>
</edmx:Runtime>
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<Connection>
<DesignerInfoPropertySet>
<DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
</DesignerInfoPropertySet>
</Connection>
<Options>
<DesignerInfoPropertySet>
<DesignerProperty Name="ValidateOnBuild" Value="true" />
<DesignerProperty Name="EnablePluralization" Value="true" />
<DesignerProperty Name="IncludeForeignKeysInModel" Value="true" />
<DesignerProperty Name="UseLegacyProvider" Value="true" />
<DesignerProperty Name="CodeGenerationStrategy" Value="None" />
</DesignerInfoPropertySet>
</Options>
<!-- Diagram content (shape and connector positions) -->
<Diagrams></Diagrams>
</Designer>
</edmx:Edmx></Mapping>
</edmx:Mappings>
</edmx:Runtime>
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<Connection>
<DesignerInfoPropertySet>
<DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
</DesignerInfoPropertySet>
</Connection>
<Options>
<DesignerInfoPropertySet>
<DesignerProperty Name="ValidateOnBuild" Value="true" />
<DesignerProperty Name="EnablePluralization" Value="true" />
<DesignerProperty Name="IncludeForeignKeysInModel" Value="true" />
<DesignerProperty Name="UseLegacyProvider" Value="true" />
<DesignerProperty Name="CodeGenerationStrategy" Value="None" />
</DesignerInfoPropertySet>
</Options>
<!-- Diagram content (shape and connector positions) -->
<Diagrams></Diagrams>
</Designer>
</edmx:Edmx>
Doh!
So it turns out it didn't like the db types I was using such as unsigned
I created Aps.net Application in which I am loading reports from database... I am facing a problem with drop down list ... this is working fine in internet explorer but not working in google chrome...
here is the image of IE :
here is the image of Chrome...
the arrow is marking the line which is showing on clicking drop down button... Kindly help me out... here is the HTML code
<telerik:RadComboBox ID="ddlMonths" Width="125" Skin="Vista" runat="server" EmptyMessage="Select Month">
<Items>
<telerik:RadComboBoxItem runat="server" Text="January" Value="1" />
<telerik:RadComboBoxItem runat="server" Text="February" Value="2" />
<telerik:RadComboBoxItem runat="server" Text="March" Value="3" />
<telerik:RadComboBoxItem runat="server" Text="April" Value="4" />
<telerik:RadComboBoxItem runat="server" Text="May" Value="5" />
<telerik:RadComboBoxItem runat="server" Text="June" Value="6" />
<telerik:RadComboBoxItem runat="server" Text="July" Value="7" />
<telerik:RadComboBoxItem runat="server" Text="August" Value="8" />
<telerik:RadComboBoxItem runat="server" Text="September" Value="9" />
<telerik:RadComboBoxItem runat="server" Text="October" Value="10" />
<telerik:RadComboBoxItem runat="server" Text="November" Value="11" />
<telerik:RadComboBoxItem runat="server" Text="December" Value="12" />
</Items>
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</telerik:RadComboBox>
Here is the usage of drop down dialog code:
ddlMonths.SelectedValue = DateTime.Now.Month.ToString();
Set EnableOverlay to true for the combo box. My best guess with the available info is that the content below the dropdown is some heavyweight content like a flash or pdf plugin that hides HTML.
I got a question:
I got a TabPane, designed in a FXML file now i want to change the name of the selected Tab,when a 'check' button is clicked.
public void onAddDateRequest(){
try {
//datePane wird in den FXML Loader geladen
FXMLLoader loader = new FXMLLoader(getClass().getResource("/homenizer/view/datePane.fxml"));
Parent content = (Parent)loader.load();
Tab tab = new Tab("Neuer Termin");
tab.setContent(content); //Dem neuen Tab wird das Layout der FXXML Datei aus Content zugewiesen
tabPane.getTabs().add(tab);
} catch (IOException ex) {
Logger.getLogger(HomenizerController.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void onCheckRequest(){
Date date = new Date();
tabPane.getSelectionModel().getSelectedItem().setText("A");
}
The 'onAddDateRequest' method is called,when u click the button to add a new tab.
Here the FXML file:
<TabPane fx:id="tabPane">
<Tab text="Willkommen" closable="true" >
<VBox>
<TitledPane text="Allgemeines" expanded="true">
<GridPane>
<Label text="Benutzername:" GridPane.columnIndex="0" GridPane.rowIndex="0" />
<Label fx:id="username" GridPane.columnIndex="1" GridPane.rowIndex="0" />
<Label text="Termine gesamt:" GridPane.columnIndex="0" GridPane.rowIndex="1" />
<Label fx:id="dates" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<Label text="Aufgaben gesamt:" GridPane.columnIndex="0" GridPane.rowIndex="2" />
<Label fx:id="toDos" GridPane.columnIndex="1" GridPane.rowIndex="2" />
</GridPane>
</TitledPane>
<TitledPane text="Aktuell" expanded="true" >
<ScrollPane>
<GridPane>
<Label text="Aktuelle Termine:" GridPane.columnIndex="0" GridPane.rowIndex="0" />
<Label fx:id="actualDates" GridPane.columnIndex="1" GridPane.rowIndex="0" />
<Label text="Aktuelle Aufgaben:" GridPane.columnIndex="0" GridPane.rowIndex="1" />
<Label fx:id="actualToDos" GridPane.columnIndex="1" GridPane.rowIndex="1" />
</GridPane>
</ScrollPane>
</TitledPane>
</VBox>
</Tab>
</TabPane>
And here the Layout for a new Tab, also coded in a FXML file
<ScrollPane fx:id="scrollPane" minHeight="350.0" xmlns:fx="http://javafx.com/fxml" fx:controller="homenizer.controller.HomenizerController">
<VBox>
<TitledPane text="Termin" expanded="true">
<GridPane fx:id="datePane" alignment="TOP_LEFT" hgap="10" vgap="10" prefWidth="900" >
<Label text="Termin Beschreibung" GridPane.columnIndex="0" GridPane.rowIndex="1" />
<TextField fx:id="dateInformation" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<Label text="Datum" GridPane.columnIndex="0" GridPane.rowIndex="2" />
<TextField fx:id="dateOfDate" GridPane.columnIndex="1" GridPane.rowIndex="2" />
<Label text="Termin beginn" GridPane.columnIndex="0" GridPane.rowIndex="3" />
<TextField fx:id="dateTimeBegin" GridPane.columnIndex="1" GridPane.rowIndex="3" />
<Label text="Termin ende" GridPane.columnIndex="2" GridPane.rowIndex="3" />
<TextField fx:id="dateTimeEnd" GridPane.columnIndex="3" GridPane.rowIndex="3" />
<Label text="Priorität" GridPane.columnIndex="0" GridPane.rowIndex="4" />
<fx:define>
<ToggleGroup fx:id="priorityGroup" />
</fx:define>
<RadioButton text="Hoch" GridPane.columnIndex="1" GridPane.rowIndex="4" toggleGroup="$priorityGroup" />
<RadioButton text="Normal" GridPane.columnIndex="1" GridPane.rowIndex="5" toggleGroup="$priorityGroup"/>
<RadioButton text="Niedrig" GridPane.columnIndex="1" GridPane.rowIndex="6" toggleGroup="$priorityGroup"/>
</GridPane>
</TitledPane>
<TitledPane text="Person/Unternehmen" ellipsisString="Persson / Unternehmen" expanded="false" >
<GridPane fx:id="personCompanyPane" hgap="10" vgap="10">
<Label text="Name" GridPane.columnIndex="0" GridPane.rowIndex="0" />
<TextField fx:id="name" GridPane.columnIndex="1" GridPane.rowIndex="0" />
<Label text="Vorname" GridPane.columnIndex="0" GridPane.rowIndex="1" />
<TextField fx:id="firstname" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<Label text="Ort" GridPane.columnIndex="0" GridPane.rowIndex="2" />
<TextField fx:id="city" GridPane.columnIndex="1" GridPane.rowIndex="2" />
<Label text="PLZ" GridPane.columnIndex="2" GridPane.rowIndex="2" />
<TextField fx:id="place" maxWidth="60" GridPane.columnIndex="3" GridPane.rowIndex="2" />
<Label text="Strasse" GridPane.columnIndex="0" GridPane.rowIndex="3" />
<TextField fx:id="street" GridPane.columnIndex="1" GridPane.rowIndex="3" />
<Label text="Hausnr." GridPane.columnIndex="2" GridPane.rowIndex="3" />
<TextField fx:id="houseNr" maxWidth="35" GridPane.columnIndex="3" GridPane.rowIndex="3" />
<Label text="Unternehmen" GridPane.columnIndex="0" GridPane.rowIndex="4" />
<TextField fx:id="company" GridPane.columnIndex="1" GridPane.rowIndex="4" />
</GridPane>
</TitledPane>
<TitledPane text="Notiz" expanded="false" >
<GridPane>
<Label text="Notiz" GridPane.columnIndex="0" GridPane.rowIndex="0" />
<TextArea GridPane.columnIndex="0" GridPane.rowIndex="1" prefWidth="900" />
</GridPane>
</TitledPane>
<HBox>
<Button fx:id="check" text="bestätigen"
onAction="#onCheckRequest"/>
<Button fx:id="cancel" text="abbrechen" />
</HBox>
</VBox>
I hope this is enough of the code for analyse the problem :)
This is my Code, everytime I get a NullPointerException, but I don't know why. The TabPane is not empty, so I don't know why I get this Exception. This is my error code:
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1456)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:28)
at javafx.event.Event.fireEvent(Event.java:171)
at javafx.scene.Node.fireEvent(Node.java:6867)
at javafx.scene.control.Button.fire(Button.java:179)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:193)
at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:336)
at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:329)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:64)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
at javafx.event.Event.fireEvent(Event.java:171)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3369)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3209)
at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3164)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1582)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2267)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:250)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:173)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:292)
at com.sun.glass.ui.View.handleMouseEvent(View.java:530)
at com.sun.glass.ui.View.notifyMouse(View.java:924)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:17)
at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:67)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:75)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:279)
at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1453)
... 64 more
Caused by: java.lang.NullPointerException
at homenizer.controller.HomenizerController.onCheckRequest(HomenizerController.java:105)
... 74 more
Thanks for every help, I don't know if you need more of my code, but I'm sure that their is no error inj the rest of my code.
So I found my error :) I set the controller for my FXML in my controllercode and not in the FXML file itself and now it works
Presently I am showing error messages at top location. But I want to show at place where i want i.e. near field. means error message for user name must be near to it.
When i am placing that tag there than it is showing null resource error.
<!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"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Prime Faces Demo</title>
<link rel="stylesheet" href="second.css" type="text/css" />
</head>
<body>
<h:body>
<f:view>
<f:loadBundle var="mg" basename="messages1"></f:loadBundle>
<h:message for="firstname" style="color:red"></h:message>
<br></br>
<h:message for="lastname" style="color:red"></h:message>
<br></br>
<h:message for="pass" style="color:red"></h:message>
<br></br>
<h:message for="date" style="color:red"></h:message>
<br></br>
<h:message for="cpass" style="color:red"></h:message>
<br></br>
<h:message for="gender" style="color:red"></h:message>
<br></br>
<h:message for="nation" style="color:red"></h:message>
<br></br>
<h:message for="faci" style="color:red"></h:message>
<br></br>
<h:message for="padd" style="color:red"></h:message>
<br></br>
<h:message for="tadd" style="color:red"></h:message>
<br></br>
<h:message for="email" style="color:red"></h:message>
<br></br>
<h:message for="phone" style="color:red"></h:message>
<br></br>
<h:message for="quali" style="color:red"></h:message>
<br></br>
<h:message for="state" style="color:red"></h:message>
<br></br>
<h:message for="hobby" style="color:red"></h:message>
<br></br>
<h:message for="zone" style="color:red"></h:message>
<br></br>
<h:form>
<h:panelGrid columns="2" width="1000">
<h:panelGrid columns="2" width="600">
<p:outputLabel value="Enter first name" style="font-weight:bold"></p:outputLabel>
<h:inputText requiredMessage="#{mg.firstname}" value="#{Userdeatil.firstname}"
required="true" id="firstname">
</h:inputText>
<p:outputLabel value="Enter last name" style="font-weight:bold" ></p:outputLabel>
<h:inputText requiredMessage="#{mg.lastname}" value="#{Userdeatil.lastname}"
required="true" id="lastname">
</h:inputText>
<p:outputLabel value="Enter password" style="font-weight:bold"></p:outputLabel>
<p:password value="#{Userdeatil.password}" required="true" requiredMessage="#{mg.password}" id="pass"></p:password>
<p:outputLabel value="ReEnter password" style="font-weight:bold"></p:outputLabel>
<p:password value="#{Userdeatil.conpassword}" required="true" requiredMessage="#{mg.confrom}" id="cpass"></p:password>
<p:outputLabel value="Enter Date of Birth" style="font-weight:bold"></p:outputLabel>
<h:inputText requiredMessage="#{mg.birth}" value="#{Userdeatil.dob}"
required="true" id="date">
</h:inputText>
<p:outputLabel value="Select Gender" style="font-weight:bold" ></p:outputLabel>
<p:selectOneRadio value="#{Userdeatil.gender}" required="true" id="gender" requiredMessage="#{mg.gender}">
<f:selectItem itemValue="male" itemLabel="Male"></f:selectItem>
<f:selectItem itemValue="female" itemLabel="Female"></f:selectItem>
</p:selectOneRadio >
<p:outputLabel value="Select Nationality" style="font-weight:bold"></p:outputLabel>
<p:selectOneRadio value="#{Userdeatil.nation}" required="true" id="nation" requiredMessage="#{mg.nation}" >
<f:selectItem itemValue="indian" itemLabel="Indian"></f:selectItem>
<f:selectItem itemValue="nonindian" itemLabel="NonIndian"></f:selectItem>
<f:selectItem itemValue="nri" itemLabel="NRI"></f:selectItem>
</p:selectOneRadio >
<p:outputLabel value="Select Account Facilities" style="font-weight:bold" ></p:outputLabel>
<h:selectManyCheckbox required="true" id="faci" requiredMessage="#{mg.faci}">
<f:selectItem itemValue="1" itemLabel="Online banking"></f:selectItem>
<f:selectItem itemValue="2" itemLabel="Credit Card"></f:selectItem>
<f:selectItem itemValue="3" itemLabel="Debit Card"></f:selectItem>
<f:selectItem itemValue="4" itemLabel="All"></f:selectItem>
</h:selectManyCheckbox>
<p:outputLabel value="Permanent Address" style="font-weight:bold"></p:outputLabel>
<p:inputTextarea value="#{Userdeatil.tadd}" required="true" id="padd" requiredMessage="#{mg.padd}"></p:inputTextarea>
<p:outputLabel value="Temporary Address" style="font-weight:bold"></p:outputLabel>
<p:inputTextarea value="#{Userdeatil.padd}" required="true" id="tadd" requiredMessage="#{mg.tadd}"></p:inputTextarea>
<p:outputLabel value="Select if both are same" style="font-weight:bold"></p:outputLabel>
<p:selectBooleanCheckbox value="#{Userdeatil.same}"></p:selectBooleanCheckbox>
<p:outputLabel value="Select Zone" style="font-weight:bold"></p:outputLabel>
<h:selectOneMenu value="#{Userdeatil.zone}" id="zone" requiredMessage="#{mg.zone}">
<f:selectItem itemLabel="Northern" itemValue="" />
<f:selectItem itemLabel="Western"></f:selectItem>
<f:selectItem itemLabel="Eastern"></f:selectItem>
<f:selectItem itemLabel="Southern"></f:selectItem>
<f:selectItem itemLabel="Central"></f:selectItem>
</h:selectOneMenu>
<p:commandButton value="Submit" action="#{Userdeatil.check}"/>
</h:panelGrid>
<h:panelGrid columns="2" >
<p:outputLabel value="Enter email" style="font-weight:bold"></p:outputLabel>
<p:inputText value="#{Userdeatil.email}" required="true" id="email" requiredMessage="#{mg.email}">
</p:inputText>
<p:outputLabel value="Enter phone number" style="font-weight:bold" ></p:outputLabel>
<p:inputText value="#{Userdeatil.phone}" required="true" id="phone" requiredMessage="#{mg.phone}"></p:inputText>
<p:outputLabel value="Enter qualification" style="font-weight:bold"></p:outputLabel>
<p:inputText value="#{Userdeatil.quali}" required="true" id="quali" requiredMessage="#{mg.quali}"></p:inputText>
<p:outputLabel value="Enter State" style="font-weight:bold"></p:outputLabel>
<p:inputText value="#{Userdeatil.state}" required="true" id="state" requiredMessage="#{mg.state}"></p:inputText>
<p:outputLabel value="Enter Hobby" style="font-weight:bold"></p:outputLabel>
<p:inputMask value="#{Userdeatil.hobbey}" required="true" id="hobby" requiredMessage="#{mg.hobby}"/>
</h:panelGrid>
</h:panelGrid>
</h:form>
</f:view>
</h:body>
</body>
</html>