ComboBox Select Items - combobox

I am trying to select a quantity to add to cart. For example, the drop down list of combo box consists of 1-10 and Others.. If I want to buy more than 10 products, I select the Others.. from drop down list and a text field will be appeared. This is how I set up my comboBox in javaFX:
<ComboBox fx:id="qtyComboBox" prefHeight="21.0" prefWidth="159.0" style="-fx-background-color:#D2B48C;" GridPane.columnIndex="1" GridPane.rowIndex="4">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="" />
<String fx:value="1" />
<String fx:value="2" />
<String fx:value="3" />
<String fx:value="4" />
<String fx:value="5" />
<String fx:value="6" />
<String fx:value="7" />
<String fx:value="8" />
<String fx:value="9" />
<String fx:value="10" />
<String fx:value="Others.." />
</FXCollections>
</items>
</ComboBox>
And this is how I get the selected item from comboBox:
if(panel.getQtyComboBox().getValue().equals("Others..")){
panel.getQtyTextField().setVisible(true);
qty = Integer.parseInt(panel.getQtyTextField().getText());
}else{
qty = Integer.parseInt(panel.getQtyComboBox().getValue());
}
However, when I choose 1-10, it can insert into database without any problem. But when I select the Others.., the text field does not appear. I wonder where did I did wrongly. Thanks in advance.

Related

I can't change range and/or default values in DevExpress Dashboard

I have a page where users register and can make their personal diet plan etc.
I am trying to make some graphs with built-in VS dashboards.
I am using VS 2015 and SQL Server Management Studio 15.0.18206.0 if that matters.
My problems are the following:
Automatic (SUM)
Dashboard values default to SUM function, which I am not able to change, as you see in the first picture, but I kind of managed to solve this problem with the help of SQL (SELECT DISTINCT, SELECT TOP(1) etc.)
Automatic (SUM)
Default year count
When I am trying to make a dashboard to show track of user's vitals and activity, which is the core of my statistics, time defaults to YEAR and the result end up like the second picture.
Default year count
There is nothing I can do to change these and I just made irrelevant graphs to fill the page, but it's a shame because I planned to make a lot of graphs with the table you see in the third picture.
User History table
If it helps, the XML code generated from the last dashboard is this:
<?xml version="1.0" encoding="utf-8"?>
<Dashboard>
<Title Text="YearDashBoard" />
<DataSources>
<SqlDataSource ComponentName="DataSource1">
<Name>UserHistory1</Name>
<Connection Name="foodConnectionString" FromAppConfig="true" />
<Query Type="SelectQuery" Name="UserHistory1" Distinct="true">
<Tables>
<Table Name="UserHistory" />
</Tables>
<Columns>
<Column Table="UserHistory" Name="CaloriesDate" />
<Column Table="UserHistory" Name="DailyCalories" />
<Column Table="UserHistory" Name="UserID" />
</Columns>
<Filter>[UserHistory.UserID] = 17</Filter>
</Query>
<ConnectionOptions CloseConnection="true" CommandTimeout="0" />
</SqlDataSource>
</DataSources>
<Items>
<Chart ComponentName="chartDashboardItem1" Name="Chart 1" DataSource="DataSource1" DataMember="UserHistory1">
<DataItems>
<Measure DataMember="DailyCalories" DefaultId="DataItem0" />
<Dimension DataMember="CaloriesDate" DefaultId="DataItem1" />
</DataItems>
<Arguments>
<Argument DefaultId="DataItem1" />
</Arguments>
<Panes>
<Pane Name="Pane 1">
<Series>
<Simple>
<Value DefaultId="DataItem0" />
</Simple>
</Series>
</Pane>
</Panes>
</Chart>
</Items>
<LayoutTree>
<LayoutGroup Weight="100">
<LayoutItem DashboardItem="chartDashboardItem1" Weight="100" />
</LayoutGroup>
</LayoutTree>
</Dashboard>
Finally, with the help of DevExpress technical team, I found out that the whole time there was an invisible scroll bar, but you had to mouse over it (!) while being on the "BINDING" tab of the menu.

Extracting entity name from FetchXml columns in Dynamics 365 Database

I'm trying to write a SQL query that shows all Advanced Find views owned by a specific user in Dynamics 365 b8.2 (on-prem).
This is pretty straight-forward in terms of getting the view name, and User from the UserQuery view, but the entity related to that view is only stored as part of the FetchXML, so I need to extract that.
Can I use XPath on Fetch XML? Any help would be awesome! Two examples of the FetchXML are as follows (the entity is Account):
<fetch mapping="logical" version="1.0" distinct="false" output-format="xml-platform">
<entity name="account">
<attribute name="name" />
<attribute name="primarycontactid" />
<attribute name="telephone1" />
<attribute name="address2_city" />
<attribute name="parentaccountid" />
<attribute name="new_navnumber" />
<attribute name="emailaddress1" />
<attribute name="new_accountmanager" />
<attribute name="accountclassificationcode" />
<attribute name="accountid" />
<order descending="false" attribute="name" />
<filter type="and">
<condition value="0" attribute="statecode" operator="eq" />
<condition value="1" attribute="new_isshareholder" operator="eq" />
<condition attribute="accountclassificationcode" operator="in">
<value>200001</value>
<value>200003</value>
<value>200005</value>
<value>200007</value>
<value>200009</value>
<value>200011</value>
<value>100000000</value>
<value>200012</value>
</condition>
</filter>
</entity>
</fetch>
FetchXml is valid XML so yes you can use xpath
Something like /fetch/entity/#name should work. Views owned by Users should be ok, but be aware that there are some non-standard system views hidden away in the system
You can also include the returnedtypecode attribute/field from the userquery entity/table. That will return the objecttypecode of the entity that the view queries.

How to publish additional postgis raster layer attributes in geoserver?

i was wondering if any of You can help me with my problem. I'm storing some rasters in Postgis database. Each raster is in its own table and besides 'rid' and 'rast' columns, I manualy added other columns to store raster attributes such as 'metadata'...
I have successfully imported rasters in geoserver using ImageMosaic JDBC and in Layers Preview (OpenLayers) I can see rasters and use getFeatureInfo function, but the problem is that function getFeatureInfo returns table with correct pixel value , 'rid' field is empty (only table header apears) and no other attribute is shown (not even attribute header in table). I'm using default geoserver method for layer preview function.
mapping.postgis.xml.inc file
<!-- possible values: universal,postgis,db2,mysql,oracle -->
<spatialExtension name="pgraster"/>
<mapping>
<masterTable name="mosaic" >
<coverageNameAttribute name="name"/>
<maxXAttribute name="maxx"/>
<maxYAttribute name="maxy"/>
<minXAttribute name="minx"/>
<minYAttribute name="miny"/>
<resXAttribute name="resx"/>
<resYAttribute name="resy"/>
<tileTableNameAtribute name="tiletable" />
</masterTable>
<tileTable>
<blobAttributeName name="rast" />
<keyAttributeName name="rid" />
<textAttributeName name="metadata" />
</tileTable>
</mapping>
connect.postgis.xml.inc
<connect>
<!-- value DBCP or JNDI -->
<dstype value="DBCP"/>
<!-- <jndiReferenceName value=""/> -->
<username value="postgres" />
<password value="postgres" />
<jdbcUrl value="jdbc:postgresql://localhost:5432/web_kartografija" />
<driverClassName value="org.postgresql.Driver"/>
<maxActive value="10"/>
<maxIdle value="0"/>
</connect>
layer.postgis.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE ImageMosaicJDBCConfig [
<!ENTITY mapping PUBLIC "mapping" "mapping.postgis.xml.inc">
<!ENTITY connect PUBLIC "connect" "connect.postgis.xml.inc">]>
<config version="1.0">
<coverageName name="jan"/> <!-- Name of the table in database -->
<coordsys name="EPSG:4326"/>
<!-- interpolation 1 = nearest neighbour, 2 = bilinear, 3 = bicubic -->
<scaleop interpolation="1"/>
<verify cardinality="false"/>
&mapping;
&connect;
</config>
I tried to include <textAttributeName name="metadata" /> as a column name where aditional data is stored, but still no effect. Can anobudy help me with this problem ? Thanks in advance !

How to make DGML graph with custome tag xml file by getting data from SQL table

I want to build a DGML with custom tags by getting data from SQL table.
The table:
UCId UCPre UCPost UCNext
-----------------------------------------------------------------------------------------------
UC01 User must be Registerd User is Loggined sucessfully UC02
UC02 User is Loggined sucessfully User is added UC03
UC03 File must be selected File is added NULL
UC04 File is added File is deleted NULL
UC05 User is Loggined sucessfully User is deleted NULL
I want the xml with following tags in nodes I want to read UCId from UCID column and UCNext column
<?xml version="1.0" encoding="utf-8"?>
<DirectedGraph Title="TestT" xmlns="http://schemas.microsoft.com/vs/2009/dgml">
<Nodes>
<Node Id="UC01" Label="UC01" />
<Node Id="UC02" Label="UC02" />
<Node Id="UC03" Label="UC03" />
</Nodes>
I want to make links between nodes on the basis of above data in tabel as UC01 the Next state is UC02 .How can i set this by coding so that correct links are created between nodes
<Links>
<Link Source="UC01" Target="UC02" Label="1"/>
<Link Source="UC02" Target="UC03" Label="2" />
</Links>
<Properties>
<Property Id="Background" Label="Background" Description="The background color" DataType="System.Windows.Media.Brush" />
<Property Id="Bounds" DataType="System.Windows.Rect" />
<Property Id="Label" Label="Label" Description="Displayable label of an Annotatable object" DataType="System.String" />
<Property Id="LabelBounds" DataType="System.Windows.Rect" />
<Property Id="Stroke" DataType="System.Windows.Media.Brush" />
<Property Id="Title" DataType="System.String" />
<Property Id="UseManualLocation" DataType="System.Boolean" />
</Properties>
</DirectedGraph>
How can I do this by c# or java please help?
Please refer to this code sample: https://gist.github.com/azukipochette/4644291
Step 1: loop through all records to create nodes.
Step 2: loop through all records again to create links (find pairs of nodes created in step 1 by label).

How to pass a variable into XPath of XQuery in an SQL statement

Scenario: I have an xml column in MSSQL database which I have to parse the XML data of that cell using XQuery .
Xml content : <AnchoredXml xmlns="urn:schema:Microsoft.Rtc.Management.ScopeFramework.2008" SchemaWriteVersion="2">
<Key ScopeClass="Global">
<SchemaId Namespace="urn:schema:Microsoft.Rtc.Management.Deploy.Topology.2008" ElementName="Topology" />
<AuthorityId Class="Host" InstanceId="00000000-0000-0000-0000-000000000000" />
</Key>
<Dictionary Count="1">
<Item>
<Key />
<Value Signature="b1ac04f7-d8f0-4300-86cf-fb2b3383536c">
<Topology xmlns="urn:schema:Microsoft.Rtc.Management.Deploy.Topology.2008">
<InternalDomains AllowAllDomains="false" DefaultDomain="ocsqa.com">
<InternalDomain Name="ocsqa.com" Authoritative="false" AllowSubDomains="false" />
</InternalDomains>
<Sites>
<CentralSite SiteId="1">
<Name>LyncSite</Name>
<Location />
</CentralSite>
</Sites>
<Clusters>
This is a piece of data of the xml content in that one cell.
I am using below query to traverse the nodes of above xml:
select #cluster = #Items.query('/DocItemSet/DocItem/Data/*[#SchemaWriteVersion="2"]/*[2]/*[1]/*[2]/*[1]/*[3]')
Output of the above query is :
<p1:Cluster xmlns:p1="urn:schema:Microsoft.Rtc.Management.Deploy.Topology.2008" RequiresReplication="true" RequiresSetup="true" Fqdn="XXXX.ocsqa.com">
<p1:ClusterId SiteId="1" Number="1" />
<p1:Machine OrdinalInCluster="1" Fqdn=" XXXX.ocsqa.com">
<p1:NetInterface InterfaceSide="Primary" InterfaceNumber="1" IPAddress="0.0.0.0" />
<p1:NetInterface InterfaceSide="External" InterfaceNumber="1" IPAddress="0.0.0.0" />
<p1:NetInterface InterfaceSide="Pstn" InterfaceNumber="1" IPAddress="0.0.0.0" />
</p1:Machine>
</p1:Cluster>
<p2:Cluster xmlns:p2="urn:schema:Microsoft.Rtc.Management.Deploy.Topology.2008" RequiresReplication="true" RequiresSetup="true" Fqdn=" XXXX2.ocsqa.com">
<p2:ClusterId SiteId="1" Number="2" />
<p2:Machine OrdinalInCluster="1" Fqdn=" XXXX2.ocsqa.com">
<p2:NetInterface InterfaceSide="Primary" InterfaceNumber="1" IPAddress="0.0.0.0" />
<p2:NetInterface InterfaceSide="External" InterfaceNumber="1" IPAddress="0.0.0.0" />
<p2:NetInterface InterfaceSide="Pstn" InterfaceNumber="1" IPAddress="0.0.0.0" />
</p2:Machine>
</p2:Cluster>
<p3:Cluster xmlns:p3="urn:schema:Microsoft.Rtc.Management.Deploy.Topology.2008" RequiresReplication="true" RequiresSetup="true" Fqdn=" XXXX2.ocsqa.com">
<p3:ClusterId SiteId="1" Number="3" />
<p3:Machine OrdinalInCluster="1" Fqdn=" XXXX2.ocsqa.com" />
</p3:Cluster>
Now using query mentioned as below :
select #fqdn = #cluster.value('(./*/*/#Fqdn)[1]','nvarchar(20)') Select #fqdn
Note the highlighted index no in above query.
Using this query we will be able to achieve the first Cluster available in xml, similarly I wanted to look for other Clusters as well.
So I wanted to use this query in while loop. For which I have to pass a variable instead of hardcoded int value. Something similar as below :
select #fqdn = #cluster.value('(./*/*/#Fqdn)[sql:variable("#test")]','nvarchar(20)')
I have referred some posts
How to use XPath with a variable in Oracle XMLTable?
http://www.jasonstrate.com/2011/01/xquery-for-the-non-expert-variable-use/
but I am getting error as below :
Msg 2389, Level 16, State 1, Line 35
XQuery [value()]: 'value()' requires a singleton (or empty sequence), found operand of type 'xdt:untypedAtomic *'
How to pass a variable into a XQuery of SQL statement?
You need to tell SQL Server that you are only interested in the a single node. Add a [1] at the end.
#cluster.value('(./*/*/#Fqdn)[sql:variable("#test")][1]','nvarchar(20)')

Resources