Invalid precision/scale on combo box
I am dragging a field over to a table view on a panel as a combo box. I go to the list binding editor to setup the data to choose from in the combo box. I am using the LOV mode to get the data from another table. Everything looks good when I test the form. The combobox shows the data from the table that i'm getting it from. The problem is when i try to change the data on the form. I'm am getting an error message stating invalid precision/scale. The field from the source LOV is named CustomerName, setup as Varchar2(30). The field in the Target attribute is named CustomerAssigned, setup as Varchar2(30). Is the problem somewhere else and this error message an erroneous message? Help!!
After much hair pulling, what I did was created a new View link of the table i used for the source, then named the field in new view link as the same as the target field and it worked. Let me see if I can explain.
Source: Customer_Master / Customer_Name
Target: Line1ProperziDtl / Customer_Assigned
The above gave me the error message. I then created a new view link from the Customer_Master:
Source: CustAssignedMaster / Customer_Assigned
Target: Line1ProperziDtl / Customer_Assigned.
This worked with no errors. Why would it matter what the field names are as long as the Datatype and Sizes are the same?
Similar Messages
-
hi when i select a value in my LOV AM GETING THIS ERROR invalid precision/scale
my LOV IS
<ViewAttribute
Name="Orgsubtypecode1"
IsNotNull="true"
PrecisionRule="true"
EntityAttrName="Orgsubtypecode"
EntityUsage="LutOrgsubtypes"
AliasName="ORGSUBTYPECODE1"
LOVName="LOV_Orgsubtypecode1">
<Properties>
<SchemaBasedProperties>
<CONTROLTYPE
Value="choice"/>
</SchemaBasedProperties>
</Properties>
</ViewAttribute>my stack error is
oracle.jbo.AttrSetValException: JBO-27010: Attribute set with value DBE for Orgsubtypecode in AppModule.OrgDetails1 has invalid precision/scale
at oracle.jbo.rules.RulesBeanUtils.createException(RulesBeanUtils.java:381)
at oracle.jbo.rules.RulesBeanUtils.createException(RulesBeanUtils.java:360)
at oracle.jbo.rules.AbstractValidator.createException(AbstractValidator.java:1077)
at oracle.jbo.rules.AbstractValidator.doRaiseException(AbstractValidator.java:1120)
at oracle.jbo.rules.AbstractValidator.raiseException(AbstractValidator.java:1109)
at oracle.jbo.rules.JboAbstractValidator.raiseException(JboAbstractValidator.java:409)
at oracle.jbo.rules.AbstractValidator.raiseException(AbstractValidator.java:1096)
at oracle.jbo.rules.JboAbstractValidator.callValidateValueWithContext(JboAbstractValidator.java:239)
at oracle.jbo.rules.JboAbstractValidator.validate(JboAbstractValidator.java:386)
at oracle.jbo.rules.RulesBeanUtils.validateObject(RulesBeanUtils.java:716)
at oracle.jbo.rules.RulesBeanUtils.validate(RulesBeanUtils.java:696)
at oracle.jbo.server.AttributeDefImpl.validate(AttributeDefImpl.java:3349)
at oracle.jbo.server.AttributeDefImpl.set(AttributeDefImpl.java:3294)
at oracle.jbo.server.EntityImpl.setAttributeInternal(EntityImpl.java:2012)
at ecadastre.gov.za.model.entities.UamOrganisationsImpl.setOrgsubtypecode(UamOrganisationsImpl.java:501)
at ecadastre.gov.za.model.entities.UamOrganisationsImpl$AttributesEnum$14.put(UamOrganisationsImpl.java:159)
at ecadastre.gov.za.model.entities.UamOrganisationsImpl.setAttrInvokeAccessor(UamOrganisationsImpl.java:531)
at oracle.jbo.server.EntityImpl.setAttribute(EntityImpl.java:1920)
at oracle.jbo.server.ViewRowStorage.setAttributeValue(ViewRowStorage.java:2363)
at oracle.jbo.server.ViewRowStorage.setAttributeInternal(ViewRowStorage.java:2165)
at oracle.jbo.server.ViewRowImpl.setAttributeInternal(ViewRowImpl.java:1453)
at oracle.jbo.server.ViewRowImpl.setAttrInvokeAccessor(ViewRowImpl.java:1428)
at oracle.jbo.server.ViewRowImpl.setAttribute(ViewRowImpl.java:1089)
at oracle.jbo.server.ViewRowImpl.setAttribute(ViewRowImpl.java:1029)
at oracle.jbo.server.ViewRowImpl.setAttributeValues(ViewRowImpl.java:1703)
at oracle.adf.model.binding.DCDataControl.setAttributesInRow(DCDataControl.java:2428)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.setAttributeValuesInRow(JUCtrlValueBinding.java:976)
at oracle.jbo.uicli.binding.JUCtrlListBinding.setTargetAttrsFromLovRow(JUCtrlListBinding.java:2801)
at oracle.jbo.uicli.jui.JUComboBoxCtrlBinding.updateTargetFromSelectedValue(JUComboBoxCtrlBinding.java:793)
at oracle.jbo.uicli.jui.JUComboBoxCtrlBinding.actionPerformed(JUComboBoxCtrlBinding.java:702)
at javax.swing.JComboBox.fireActionEvent(JComboBox.java:1240)
at javax.swing.JComboBox.setSelectedItem(JComboBox.java:567)
at javax.swing.JComboBox.setSelectedIndex(JComboBox.java:603)
at javax.swing.plaf.basic.BasicComboPopup$Handler.mouseReleased(BasicComboPopup.java:817)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:273)
at java.awt.Component.processMouseEvent(Component.java:6289)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at javax.swing.plaf.basic.BasicComboPopup$1.processMouseEvent(BasicComboPopup.java:481)
at java.awt.Component.processEvent(Component.java:6054)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4652)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:617)
at java.awt.EventQueue$2.run(EventQueue.java:615)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)Can you check whats the precision/scale and datatype of the attribute from corresponding EO attribute. That will clarify things.
-
JBO-27010: Attribute set ... has invalid precision/scale
We have created a table ACCOUNT with a column RATE defined as NUMBER(5, 3).
Bc4j has created the corresponding entity object Account with:
<Attribute
Name="Rate"
Type="oracle.jbo.domain.Number"
ColumnName="RATE"
ColumnType="NUMBER"
SQLType="NUMERIC"
IsNotNull="true"
Precision="5"
Scale="3"
TableName="ACCOUNT" >
Also the corresponding view object AccountView has been created.
Here is the java code (JDeveloper Ver.3.2.3) where we catch an exception:
ViewObject vo = applicationModule.findViewObject("AccountView");
Row r = vo.createRow();
String rateStr = "12,725"; // comma used locally as decimal separator
oracle.jbo.domain.Number rateN = new oracle.jbo.domain.Number(rateStr);
r.setAttribute("Rate", rateN);
The exception is:
oracle.jbo.AttrSetValException: JBO-27010: Attribute set with value 12,725 for Rate in Account has invalid precision/scale
Any help would be greatly appreciated.
Thanks in advance.
nullI like to tell you that now everything is ok.
Looking at the libraries included in my project, I found an unecessary library "JBO Generic Domains" (X:\Program Files\Oracle\JDeveloper 3.2.3\lib\jbodomgnrc.zip) containing a class oracle.jbo.domain.Number different from the right one in "JBO Oracle Domains" (X:\Program Files\Oracle\JDeveloper 3.2.3\lib\jbodomorcl.zip). -
Changing xy graph scale using combo box selection
Hello,
I have a xy graph with x scale set to 10k and y scale set to 6 by default.
I have a combo box which i use to select what the graph will display. For example in combo box i have 3 choices, A, B, C.
If i select A, xy scale is set to 10k and 6. If i select B, xy scale is set to 2.5k and 8, if i select C, xy scale is set to 4k and 10 respectively. Is there some functions that i can use to do this?
Thanks.
Solved!
Go to Solution.Like this (attached)?
Of course, if the data actually follows these mins and maxes, you could just turn on auto scaling and it would do it automatically
Tim Elsey
LabVIEW 2010, 2012
Certified LabVIEW Architect
Attachments:
Untitled 1.vi 14 KB -
No error when Method Operation sets invalid precision in EO
Hi,
I stumbled upon a very strange behavior (bug ?) reproduced in the following simple test case.
Studio Edition Version 11.1.2.3.0, Build JDEVADF_11.1.2.3.0_GENERIC_120914.0223.6276.1
Using HR with default VO & EO for the regions table, I create a client interface AM method where sets an invalid value to the RegionName attribute:
public void updateWithIllegalValueFromAM(){
try {
getRegions1().getCurrentRow().setAttribute("RegionName", "012345678901234567890123456789"); // (1)invalid precision/scale should be max 25 chars
} catch (Exception e) {
e.printStackTrace();//<-- Never executed
throw new JboException(e); //<-- Never executed
System.out.println(" updateWithIllegalValueFromAM End ");
}Next in the JSP I create a read only form for the Region1 VO, including navigation, a button for the method operation and finally a commit operation.
Running the above and pressing the method operation button, the expected behavior is to see an error message but it is never shown until the transaction being committed.
Debugging I see that an exception is raised in the setter of the attribute but it doesn’t bubble up till the (1) catch statement.
As you might guess the real case is a read only screen with buttons for making actions for the current record . I assumed that the EO validations should be honored in such scenario but I am wrong …
If you have any clue why this happens please share it with me!
Yiannis
Edited by: Tses on Mar 22, 2013 1:06 AMThanks Sudipto,
I inserted the try/catch block for debugging, just to ensure that catch is never executed, that is the e.printStackTrace is not printed.
To be more clear I edited the above code.
Yiannis -
Hi guys 'n' guysies - I need to upscale a combo box so I did
on(load) {
this._xscale *= 3;
this._yscale *= 3;
} // which works great for buttons...
and hey presto - it got twice as big - well it did, but its
drop down contents list didn't - what else do I need to do to get
it all twice its default size?
TIA
NigelComboBox.dropdown has the same parent as ComboBox, so you'll
need to scale
it too.
For example:
on(load) {
this._xscale *= 3;
this._yscale *= 3;
this.dropdown._xscale = this._xscale;
this.dropdown._yscale = this._yscale; -
Adding an event listener to combo box
I am working on a mortgage calculator and I cannot figure out how to add an event listener to a combo box.
I want to get the mortgage term and interest rate to calucate the mortgage using the combo cox. Here is my program.
Modify the mortgage program to allow the user to input the amount of a mortgage
and then select from a menu of mortgage loans: 7 year at 5.35%, 15 year at 5.50%, and
30 year at 5.75%. Use an array for the different loans. Display the mortgage payment
amount. Then, list the loan balance and interest paid for each payment over the term
of the loan. Allow the user to loop back and enter a new amount and make a new
selection, with resulting new values. Allow user to exit if running as an application
(can't do that for an applet though).
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.text.NumberFormat;
import java.util.Locale;
//creates class MortgageCalculator
public class MortgageCalculator extends JFrame implements ActionListener {
//creates title for calculator
JPanel row = new JPanel();
JLabel mortgageCalculator = new JLabel("MORTGAGE CALCULATOR", JLabel.CENTER);
//creates labels and text fields for amount entered
JPanel firstRow = new JPanel(new GridLayout(3,1,1,1));
JLabel mortgageLabel = new JLabel("Mortgage Payment $", JLabel.LEFT);
JTextField mortgageAmount = new JTextField(10);
JPanel secondRow = new JPanel();
JLabel termLabel = new JLabel("Mortgage Term/Interest Rate", JLabel.LEFT);
String[] term = {"7", "15", "30"};
JComboBox mortgageTerm = new JComboBox(term);
JPanel thirdRow = new JPanel();
JLabel interestLabel = new JLabel("Interest Rate (%)", JLabel.LEFT);
String[] interest = {"5.35", "5.50", "5.75"};
JComboBox interestRate = new JComboBox(interest);
JPanel fourthRow = new JPanel(new GridLayout(3, 2, 10, 10));
JLabel paymentLabel = new JLabel("Monthly Payment $", JLabel.LEFT);
JTextField monthlyPayment = new JTextField(10);
//create buttons to calculate payment and clear fields
JPanel fifthRow = new JPanel(new GridLayout(3, 2, 1, 1));
JButton calculateButton = new JButton("CALCULATE PAYMENT");
JButton clearButton = new JButton("CLEAR");
JButton exitButton = new JButton("EXIT");
//Display area
JPanel sixthRow = new JPanel(new GridLayout(2, 2, 10, 10));
JLabel displayArea = new JLabel(" ", JLabel.LEFT);
JTextArea textarea = new JTextArea(" ", 8, 50);
public MortgageCalculator() {
super("Mortgage Calculator"); //title of frame
setSize(550, 350); //size of frame
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container pane = getContentPane();
GridLayout grid = new GridLayout(7, 3, 10, 10);
pane.setLayout(grid);
pane.add(row);
pane.add(mortgageCalculator);
pane.add(firstRow);
pane.add(mortgageLabel);
pane.add(mortgageAmount);
pane.add(secondRow);
pane.add(termLabel);
pane.add(mortgageTerm);
pane.add(thirdRow);
pane.add(interestLabel);
pane.add(interestRate);
pane.add(fourthRow);
pane.add(paymentLabel);
pane.add(monthlyPayment);
monthlyPayment.setEnabled(false);
pane.add(fifthRow);
pane.add(calculateButton);
pane.add(clearButton);
pane.add(exitButton);
pane.add(sixthRow);
pane.add(textarea); //adds texaarea to frame
pane.add(displayArea);
setContentPane(pane);
setVisible(true);
//Adds Listener to buttons
calculateButton.addActionListener(this);
clearButton.addActionListener(this);
exitButton.addActionListener(this);
mortgageTerm.addActionListener(this);
interestRate.addActionListener(this);
public void actionPerformed(ActionEvent event) {
Object command = event.getSource();
JComboBox mortgageTerm = (JComboBox)event.getSource();
String termYear = (String)mortgageTerm.getSelectedItem();
if (command == calculateButton) //calculates mortgage payment
int year = Integer.parseInt(mortgageTerm.getText());
double rate = new Double(interestRate.getText()).doubleValue();
double mortgage = new Double(mortgageAmount.getText()).doubleValue();
double interest = rate /100.0 / 12.0;
double monthly = mortgage *(interest/(1-Math.pow(interest+1,-12.0 * year)));
NumberFormat myCurrencyFormatter;
myCurrencyFormatter = NumberFormat.getCurrencyInstance(Locale.US);
monthlyPayment.setText(myCurrencyFormatter.format(monthly));
if(command == clearButton) //clears all text fields
mortgageAmount.setText(null);
//mortgageTerm.setText(null);
//interestRate.setText(null);
monthlyPayment.setText(null);
if(command == exitButton) //sets exit button
System.exit(0);
public static void main(String[] arguments) {
MortgageCalculator mor = new MortgageCalculator();The OP already did this to both JComboBoxes.
mochatay, here is a new actionPerformed method for you to use.
I've improved a few things here and there...
1) You can't just cast the ActionEvent's source into a JComboBox!
What if it was a JButton that fired the event? Then you would get ClassCastExceptions (I'm sure you did)
So check for all options, what the source of the ActionEvent actually was...
2) You can't assume the user will always type in valid data.
So enclose the Integer and Double parse methods in try-catch brakcets.
Then you can do something when you know that the user has entered invalid input
(like tell him/her what a clumsy idiot they are !)
3) As soon as user presses an item in any JComboBox, just re-calculate.
I did this here by programmatically clicking the 'Calculate' button.
Alternatively, you could have a 'calculate' method, which does everything inside the
if(command==calculateButton) if-block.
This will be called when:
a)calculateButton is pressed
b)when either of the JComboBoxes are pressed.
public void actionPerformed (ActionEvent event)
Object command = event.getSource ();
if (command == calculateButton) //calculates mortgage payment
int year = 0;
double rate = 0;
double mortgage = 0;
double interest = 0;
/* If user has input invalid data, tell him so
and return (Exit from this method back to where we were before */
try
year = Integer.parseInt (mortgageTerm.getSelectedItem ().toString ());
rate = new Double (interestRate.getSelectedItem ().toString ()).doubleValue ();
mortgage = new Double (mortgageAmount.getText ()).doubleValue ();
interest = rate / 100.0 / 12.0;
catch (NumberFormatException nfe)
/* Display a message Dialogue box with a message */
JOptionPane.showMessageDialog (this, "Error! Invalid input!");
return;
double monthly = mortgage * (interest / (1 - Math.pow (interest + 1, -12.0 * year)));
NumberFormat myCurrencyFormatter;
myCurrencyFormatter = NumberFormat.getCurrencyInstance (Locale.US);
monthlyPayment.setText (myCurrencyFormatter.format (monthly));
else if (command == clearButton) //clears all text fields
/* Better than setting it to null (I think) */
mortgageAmount.setText ("");
//mortgageTerm.setText(null);
//interestRate.setText(null);
monthlyPayment.setText ("");
else if (command == exitButton) //sets exit button
System.exit (0);
else if (command == mortgageTerm)
/* Programmatically 'clicks' the button,
As is user had clicked it */
calculateButton.doClick ();
else if (command == interestRate)
calculateButton.doClick ();
//JComboBox mortgageTerm = (JComboBox) event.getSource ();
//String termYear = (String) mortgageTerm.getSelectedItem ();
}Hope this solves your problems.
I also hope you'll be able to learn from what I've indicated, so you can use similar things yourself
in future!
Regards,
lutha -
Looping through an array to get the index for each measure in a combo box
Hi folks,
I am working on a web application that has two combo boxes, one for year (called yearcombo) and for measures (called myURL) for that selected year, and also two radiobuttons (in radioBtnGroup). I have two years and a bunch of measure for each year. I have a map tool tip that when you mouse over the county you see a measure for that specific year. However I have a bunch of measures for each year and I want to be able to loop through the measures (which are in an array collection inside a combobox) so my "if" expression can find every selectedIndex and bring me the tool tip for that selected measure for that selected radio button. Right now I would have to create if statements for each measure (each selectedIndex inside the myURL combobox)and each radiobutton (inside the radioBtnGroup) instead of creating a if expression to get a map tip tool for each measure. I know I would have to create a loop to search for these indexes and enter that in the if expression and also change the graphic.attributes to reflect the right measure or index selected. Do you API for Flex wizards can give me any tips on how to code this according to my code below ? Any help is greatly appreciated! (the print scree is attached)
Below is the code snippet:
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 0)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirIndOut.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
And below is the combo boxes with the arrays
<mx:FormItem label="Year :" >
<mx:ComboBox id="yearcombo" selectedIndex="0" labelField="label" width="100%" change="changeEvt(event)" >
<mx:ArrayCollection id="year" >
<fx:Object label="2007" year="2007" />
<fx:Object label="2009" year="2009" />
</mx:ArrayCollection>
</mx:ComboBox>
</mx:FormItem>
<mx:FormItem label="Measure:">
<mx:ComboBox id="myURL" selectedIndex="8" width="80%" mouseOver="clickEv2(event)" close="closeHandler(event)">
<mx:ArrayCollection id="measures" >
<fx:Object id="forindout07" labeltext="2007 Forestry Industry Output" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_07_forest_industry_output" year="2007" />
<fx:Object id="foremp07" label="2007 Forestry Employment " value="RADIO_BUTTONS/TFEI_07_forest_employment" year="2007" />
<fx:Object id="forlabinc07" label="2007 Forestry Labor Income " value="RADIO_BUTTONS/TFEI_07_forest_labincome" year="2007" />
<fx:Object id="forindbustax07" label="2007 Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_07_forest_business_tax" year="2007" />
<fx:Object id="forindout09" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_09_forest_industry_output" year="2009" />
<fx:Object id="foremp09" label="2009 Forestry Employment " value="RADIO_BUTTONS/TFEI_09_forest_employment" year="2009" />
<fx:Object id="forlabinc09" label="2009 Forestry Labor Income " value="RADIO_BUTTONS/TFEI_09_forest_labincome" year="2009" />
<fx:Object id="forindbustax09" label="2009 Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_09_forest_business_tax" year="2009" />
<fx:Object id="blank" label=" " />
</mx:ArrayCollection>And here is the entire code
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:esri="http://www.esri.com/2008/ags"
paddingBottom="8" paddingLeft="8"
paddingRight="8" paddingTop="8"
backgroundColor="0xffffff"
layout="vertical" >
<!-- Start Declarations -->
<fx:Declarations>
<esri:SimpleFillSymbol id="mouseOverSymbol" alpha="0.5" color="0x808080">
<esri:SimpleLineSymbol width="0" color="#000000"/>
</esri:SimpleFillSymbol>
<esri:SimpleFillSymbol id="defaultsym" alpha="0.01" color="#E0E0E0" >
<esri:SimpleLineSymbol width="1" color="#000000"/>
</esri:SimpleFillSymbol>
<!-- End Declarations -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import com.esri.ags.Graphic;
import com.esri.ags.SpatialReference;
import com.esri.ags.esri_internal;
import com.esri.ags.events.GraphicEvent;
import com.esri.ags.geometry.Extent;
import com.esri.ags.layers.ArcGISDynamicMapServiceLayer;
import com.esri.ags.symbols.SimpleFillSymbol;
import com.esri.ags.symbols.SimpleLineSymbol;
import flash.utils.flash_proxy;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.controls.RadioButton;
import mx.controls.TextArea;
import mx.events.DropdownEvent;
import mx.events.ItemClickEvent;
import mx.rpc.Fault;
import mx.rpc.events.FaultEvent;
import flash.display.Sprite;
import flash.events.ErrorEvent;
import flash.events.MouseEvent;
private function closeHandler(evt:DropdownEvent):void {
myLabel.text = ComboBox(evt.target).selectedItem.labeltext;
private function loadLayerName():void
myLegend.layers = null;
layerPanel.removeAllChildren();
//loop through each layer and add as a radiobutton
for(var i:uint = 0; i < (dynamicLayer.layerInfos.length); i++)
var radioBtn:RadioButton = new RadioButton;
radioBtn.groupName = "radioBtnGroup";
radioBtn.value = i;
radioBtn.label = dynamicLayer.layerInfos[i].name;
if (dynamicLayer.layerInfos[i].name == "Direct Impact (Million $)")
radioBtn.label = "Direct Impact";
else if (dynamicLayer.layerInfos[i].name == "Total Impact (Million $)")
{radioBtn.label = "Total Impact";
else if (dynamicLayer.layerInfos[i].name == "Total Impact (Jobs)")
{radioBtn.label = "Total Impact";
else if (dynamicLayer.layerInfos[i].name == "Direct Impact (Jobs)")
{radioBtn.label = "Direct Impact";
else
{radioBtn.visible= false;
layerPanel.addChild(radioBtn);
/* myDividerBox.getDividerAt(0).visible = false; */
//set the visible layer the first radio button
radioBtnGroup.selectedValue = 0;
dynamicLayer.visibleLayers = new ArrayCollection([0]);
myLegend.layers = [dynamicLayer];
myLegend.visible = true;
private function radioClickHandler(event:ItemClickEvent):void
myLegend.layers = null;
// update the visible layers to only show the layer selected
dynamicLayer.visibleLayers = new ArrayCollection([event.index]);
myLegend.layers = [dynamicLayer];
private function changeEvt(event:Event):void {
if (yearcombo.selectedItem.year == "2007")
measures.filterFunction=filter1
measures.refresh()
myURL.dataProvider=measures
else if (yearcombo.selectedItem.year == "2009")
measures.filterFunction=filter2
measures.refresh();
public function filter1(item:Object):Boolean
if (item.year=="2007") return true
else return false
public function filter2(item:Object):Boolean
if (item.year=="2009") return true
else return false
private function clickEvt(event:Event):void {
if (yearcombo.selectedItem.year == "2007")
measures.filterFunction=filter3
measures.refresh()
myURL.dataProvider=measures
else if (yearcombo.selectedItem.year == "2009")
measures.filterFunction=filter4
measures.refresh();
public function filter3(item:Object):Boolean
if (item.year=="2007") return true
else return false
public function filter4(item:Object):Boolean
if (item.year=="2009") return true
else return false
private function clickEv2(event:Event):void {
if (yearcombo.selectedItem.year == "2007")
measures.filterFunction=filter5
measures.refresh()
else if (yearcombo.selectedItem.year == "2009")
measures.filterFunction=filter6
measures.refresh();
else if (yearcombo.selectedItem.year == 2007 && myURL.selectedIndex==8)
myLegend.layers = null;
layerPanel.removeAllChildren();
public function filter5(item:Object):Boolean
if (item.year=="2007") return true
else return false
public function filter6(item:Object):Boolean
if (item.year=="2009") return true
else return false
/* IF YOU WANT TO INCLUDE OTHER VALUES IN THE MAP TOOLTIP LIKE COUNTY NAME AND THE LABEL OF THE SELECTED ITEM
if (myURL.selectedIndex==0)
myTextArea.htmlText = "<b>County: </b>" + gr.attributes.NAME + "\n"
+ "<b>Measure: </b>" + myURL.selectedItem.label + gr.attributes.ForDirIndOut.toString()
public function fLayer_graphicAddHandler(event:GraphicEvent):void
event.graphic.addEventListener(MouseEvent.MOUSE_OVER, onMouseOverHandler);
event.graphic.addEventListener(MouseEvent.MOUSE_OUT, onMouseOutHandler);
public function onMouseOverHandler(event:MouseEvent):void
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 0)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirIndOut.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 1)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpIndOut.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 0)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirEmp.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 1)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpEmp.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 0)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirLabInc.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 1)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpLabInc.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 3 )
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForIndirBusTax.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 0)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirIndOut.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 1)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpIndOut.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 0)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirEmp.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 1)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpEmp.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 0)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirLabInc.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 1)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpLabInc.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 3 )
fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForIndirBusTax.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
public function onMouseOutHandler(event:MouseEvent):void
var gr:Graphic = Graphic(event.target);
gr.symbol = defaultsym;
myMap.infoWindow.hide();
]]>
</fx:Script>
<fx:Style>
@namespace esri "http://www.esri.com/2008/ags";
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
@namespace esri "http://www.esri.com/2008/ags";
@namespace components "com.esri.ags.components.*";
components|InfoWindow
content-background-alpha : 0.4;
background-color : #4A7138;
background-alpha : 0.7;
border-style : solid;
</fx:Style>
<mx:HBox width="930" height="800" id="mapHbox" horizontalAlign="center" >
<mx:HBox width="80">
</mx:HBox>
<mx:HBox id="myHBox" width="800" height="600" backgroundColor="0xffffff" >
<mx:VBox height="590" width="358" >
<!-- <mx:Panel
width="356" height="100%"
color="0x000000"
borderAlpha="0.15"
>
-->
<mx:Canvas height="100%" width="100%" backgroundColor="0xffffff" >
<esri:Map id="myMap" openHandCursorVisible="false"
height="100%"
logoVisible="false"
doubleClickZoomEnabled="false"
scrollWheelZoomEnabled="false"
zoomSliderVisible="false"
scaleBarVisible="false" scale="4000000" >
<esri:extent>
<esri:Extent xmin="-10736651.061900" ymin="4024099.909700" xmax="-10409195.669800" ymax="3440153.831100" >
<esri:SpatialReference wkid="102100"/>
</esri:Extent>
</esri:extent>
<esri:ArcGISDynamicMapServiceLayer id="dynamicLayer2"
url="http://tfs-24279/ArcGIS/rest/services/RADIO_BUTTONS/counties_layer/MapServer" />
<esri:ArcGISDynamicMapServiceLayer id="dynamicLayer" name=" "
alpha="1"
load="loadLayerName()"
url="http://tfs-24279/ArcGIS/rest/services/{myURL.selectedItem.value}/MapServer" />
<esri:FeatureLayer id="fLayer"
graphicAdd="fLayer_graphicAddHandler(event)"
mode="snapshot"
outFields="*"
symbol="{defaultsym}"
url= "http://tfs-24279/ArcGIS/rest/services/RADIO_BUTTONS/feature_layer_0709_five/FeatureServer/ 0" />
</esri:Map>
</mx:Canvas>
<!-- </mx:Panel>-->
</mx:VBox>
<mx:VBox height="590" width="20" >
</mx:VBox>
<mx:Canvas height="500" width="400" backgroundColor="0xffffff"
horizontalScrollPolicy="off"
verticalScrollPolicy="off" >
<mx:VBox width="420" height="50%" paddingLeft="5" paddingTop="10" paddingRight="10" paddingBottom="10"
verticalGap="8">
<mx:Form >
<mx:FormItem label="Year :" >
<mx:ComboBox id="yearcombo" selectedIndex="0" labelField="label" width="100%" change="changeEvt(event)" >
<mx:ArrayCollection id="year" >
<fx:Object label="2007" year="2007" />
<fx:Object label="2009" year="2009" />
</mx:ArrayCollection>
</mx:ComboBox>
</mx:FormItem>
<mx:FormItem label="Measure:">
<mx:ComboBox id="myURL" selectedIndex="8" width="80%" mouseOver="clickEv2(event)" close="closeHandler(event)">
<mx:ArrayCollection id="measures" >
<fx:Object id="forindout07" labeltext="Forestry Industry Output" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_07_forest_industry_output" year="2007" />
<fx:Object id="foremp07" label="Forestry Employment " value="RADIO_BUTTONS/TFEI_07_forest_employment" year="2007" />
<fx:Object id="forlabinc07" label="Forestry Labor Income " value="RADIO_BUTTONS/TFEI_07_forest_labincome" year="2007" />
<fx:Object id="forindbustax07" label="Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_07_forest_business_tax" year="2007" />
<fx:Object id="forindout09" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_09_forest_industry_output" year="2009" />
<fx:Object id="foremp09" label="Forestry Employment " value="RADIO_BUTTONS/TFEI_09_forest_employment" year="2009" />
<fx:Object id="forlabinc09" label="Forestry Labor Income " value="RADIO_BUTTONS/TFEI_09_forest_labincome" year="2009" />
<fx:Object id="forindbustax09" label="Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_09_forest_business_tax" year="2009" />
<fx:Object id="blank" label=" " />
</mx:ArrayCollection>
</mx:ComboBox>
</mx:FormItem>
</mx:Form>
<mx:VBox id="layerPanel" width="50%" height="8%" verticalGap="3" paddingLeft="17">
<mx:RadioButtonGroup id="radioBtnGroup" itemClick="radioClickHandler(event)" />
</mx:VBox>
<mx:VBox paddingLeft="17" height="50%" >
<mx:Canvas id="legendPanel" width="100%" >
<mx:Label id="myLabel" text=" " fontWeight="bold" />
<esri:Legend id="myLegend"
layers="{[dynamicLayer]}"
map="{myMap}" visible="false"
respectCurrentMapScale="false"/>
</mx:Canvas>
<mx:TextArea width="275" borderAlpha="0" height="200" >
<mx:htmlText >
<![CDATA[<font size='11'><b>Note:</b> Counties in white indicate either no data is available for that measure or the data has been supressed due to confidentiality.</font>
]]>
</mx:htmlText>
</mx:TextArea>
</mx:VBox>
</mx:VBox>
</mx:Canvas>
</mx:HBox>
</mx:HBox>
</mx:Application> -
VBA Userforms – Getting errors when item from combo box is not selected
Hi there
Thank you in advance for taking the time to check this out.
Objective:
I have 2 combo boxes, one is dependent on what has been selected in the first combo box (dynamic named range), they work fine except for an irritating error when the user accidentally clicks in the empty
Cmbox_IncCategory and it won’t allow the user to go back to the
cmbx_Category_Type box if the user forgot he had to make a selection from that first before selecting the
Cmbox_IncCategory.
The error that pops up is “Invalid property value”.
I tried having text in there to say “please select from Cmbox_IncCategory first, but that didn’t fix it.
I tried to ‘If error resume next’ but that didn’t like it either. Now I am stumped.
Main combo box= cmbx_Category_Type
2nd combo box (displaying a list dependent on what was selected in Main combo box)= Cmbox_IncCategory
I know there must be a way to fix it so that if a user clicks on the combo box, but doesn’t make a selection it won’t lock up the form.
Yes, it is a mandatory field, and I was considering using a message box to advise the user that this must be completed, but I am not sure how to do it (and avoid the errors
Here’s the current code I have for the combo boxes.
Me.Cmbox_IncCategory = "" 'Clears the contents of the 2nd combobox when another category is chosen
On Error Resume Next
'I can't seem to have the Incident Category combobox to be empty when the form is open _
I have tried Cmbox_IncCategory.Value = "", but I get an error. I then tried Cmbox_IncCategory.text = "" _
but also get the error. I don't know how else to get it to work .. I tried both codes in the _
form_initialize, but get an error ... I'm stumped !
Select Case Me.cmbx_Category_Type
Case "Crime"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_CRIME"
Case "Property Damage - Minor - NS"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_PROPRTY_NS"
Case "Property Damage - Significant - S"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_Proprty_S"
Case "Safety"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_SAFETY"
Case "Security Breach"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_BREACH_S"
Case "Support"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_SUPPORT"
Case "Vehicle"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_VEHICLE_S"
End Select
End Sub
I’d be really grateful if someone could help me out, or perhaps direct me to where I might find some coding that will achieve the result I am seeking.
This links to
My Sample form
With much gratitude,
TheShyButterfly
Hope you have a terrific day, theShyButterflyHi Peter,
Thank you for your quick response :) Brave man! :)
Both combo boxes are blank to start with (because nothing has been selected). If I click on the first combo box (cmbx_Category_Type) which lists the main events/category types, but I don't select any thing, and I click in the secondary box
(Cmbox_IncCategory) and then click on any other control, I get an “Invalid property value” error. When I click OK on the error (a few times) and I return to the code window, it gives no indication where/what is breaking
the code/causing the error. I have no choice but to exit the form by stopping in the code window.
If I click on the first textbox, (cmbx_Category_Type), and then do the right thing and make a selection, then I have no problems with the secondary textbox (Cmbox_IncCategory).
As I am not that up on VBA I am trying to follow your instructions... I have changed the code as follows, removed and replaced the rowsource name, but I encounter the very same problem.
When I changed my code from Me.Cmbox_IncCategory="" to yours myCombo.ListIndex = -1 (changing the combo box name to reflect my combo box name) and adding the second line of code ...
Me.Cmbox_IncCategory.ListIndex = 0 I still got the same behaviour and error.
I even tried moving each row of the named rows down one row (so that there would be a 'blank' row which could be selected to get out of trouble, but it wasn't very successful either.
Have you opened my form to see what happens, I included the link so whoever was looking at my problem (and yes, I have many I know), could see for themselves what it is doing/not doing.
The code now reads as below (is this what you meant?) - the results were as I mentioned above.
Me.Cmbox_IncCategory.ListIndex = -1 'Clears the contents of the 2nd combobox when another category is chosen
Me.Cmbox_IncCategory.ListIndex = 0
' On Error Resume Next
'I can't seem to have the Incident Category combobox to be empty when the form is open _
I have tried Cmbox_IncCategory.Value = "", but I get an error. I then tried Cmbox_IncCategory.text = "" _
but also get the error. I don't know how else to get it to work .. I tried both codes in the _
form_initialize, but get an error ... I'm stumped !
Select Case Me.cmbx_Category_Type
Case "Crime"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_CRIME"
Case "Property Damage - Minor - NS"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_PROPRTY_NS"
Case "Property Damage - Significant - S"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_Proprty_S"
Case "Safety"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_SAFETY"
Case "Security Breach"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_BREACH_S"
Case "Support"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_SUPPORT"
Case "Vehicle"
Me.Cmbox_IncCategory.RowSource = "Inc_Cat_VEHICLE_S"
End Select
End Sub
I appreciate your patience :) I am growing in knowledge, but its a slow process. Please let me know if there is anything else I can help clarify for you :)
This links to
My Sample form
Thanking you again
TheShyButterfly
Hope you have a terrific day, theShyButterfly -
Combo box displays value instead of label
I have several combo boxes on a vi that will occasionally start displaying the value of an certain items instead of the string label when an element is selected. The only way to fix it is to deleted the combo box and replace it with another. This has happened several times on the same vi. Sometimes it is ok when the vi is run in the IDE but shows up in an executable. Is this a bug?
Thanks,
Bill FI think this is to be expected. Your control will have a value with no associated text.
It would be much more dangerous if LabVIEW would randomly change (e.g. coerce) the value when the strings array gets shorter by some mechanism.
You have several possibilities, for example:
(1) Check the value and coerce to the highest valid entry or switch to entry zero.
(2) Keep the array of strings at constant size, but replace the unwanted entries with empty strings (see attached), the string "out of range", "invalid selection", or similar.
LabVIEW Champion . Do more with less code and in less time .
Attachments:
ComboMOD.vi 24 KB -
Hello All,
I am creating a form with a combo box but the data from the table is duplicating. Can anyone provide guidance on how to make the combo box only display only two choices of the data? For example, when the box is selected the drop down list
will have multiple/group of 'Yes' and 'No'. It appears that everytime a record is added to the table, it gets duplicated. I think I'm overlooking something from working long on this and it maybe something simple/obvious. Any
help would be appreciated, thanks.
EvinAs Bruce said you can use the DISTINCT predicate to suppress duplicate rows, but if you are getting duplicates in a combo box's list it suggests that you are querying the wrong table as the Control's RowSource property. If we take a simple example
of a combo box to list states, then the following would return duplicates of the table contains rows for two or more cities in the same state:
SELECT State
FROM Cities
ORDER BY State;
You could suppress the duplicates with:
SELECT DISTINCT State
FROM Cities
ORDER BY State;
but the correct solution would be:
SELECT State
FROM States
ORDER BY State;
i.e. in the Cities table State is a foreign key column referencing the primary key of States. You might ask why have a States table at all as the values are already in Cities? The answer is that by having a States table you can enforce referential
integrity in the relationship between Cities and States, preventing the insertion of invalid State values into Cities. Without protecting the integrity of the database in this way errors in data entry will sooner or later occur (Murphy's Law is infallible
in this respect!). I have personal experience which is testament to this, having once found three versions of my own name as author in a table of references to technical articles in my own field of work. As far as the database is concerned this
makes me three separate people! The table should have referenced the key of an Authors table of course.
Ken Sheridan, Stafford, England -
I'm trying to make a custom calculation Javascript for a combo box and can't figure out the calculation.
There are a few variables at play. I would like to incorporate a sliding scale for a student's high school gpa that looks like this:
Students GPA: SAT Score ACT Score
2.00 1010 86
2.025 1000 85
Students GPA=Combo Box1
Combo Box2=(If GPA=2.022, event.value=1010/86)
Combo Box2=(If GPA=2.028, event value=1000/85)
and so on (the scale continues on up to GPA=3.525
How would I calculate that?
Thanks for your helpAcrobat Scripting Forum http://forums.adobe.com/community/acrobat/acrobat_scripting
-
When I press my combo box, my processor stops
Hello,
I'm building my applications witch has a combo box to choose some timmings for choosing graph scales.
Sometimes, when I press this combo box, my processor load goes to zero and the rest of the application stops due to this.
If I restart my PC, this problem is solved... until the next time it happens - it can take days...
Has anyone experienced this?
Thanks,
PauloHere it is, sorry that it's big, I'm working on separating the acquisition from the interface to make it smaller.
But I'm affraid that you won't be able to see it, I just see it sometimes and then only some days latter it happens...
I realised that if I close LabVIEW it is solved - it's not needed to restart the PC.
Any comments on the code are appreciated.
Thanks,
Paulo
Attachments:
Main.zip 2928 KB -
How to populate data in the data table on combo box change event
hi
i am deepak .
i am very new to JSF.
my problem is i want to populate data in the datatable on the combo box change event.
for example ---
combo box has name of the city. when i will select a city
the details of the city should populate in the datatable. and if i will select another city then the datatable should change accordingly..
its urgent
reply as soon as possible
thanks in advancei am using Rational Application Developer to develop my application.
i am using a combo box and i am assigning cityName from the SDO.
and i am declaring a variable in the pageCode eg.
private String cityName;
public void setCityName(String cityName){
this.cityName = cityName;
public String getCityName(){
return cityName;
<h:selectOneMenu id="menu1" styleClass="selectOneMenu" value="#{pc_Test1.loginID}" valueChangeListener="#{pc_Test1.handleMenu1ValueChange}">
<f:selectItems
value="#{selectitems.pc_Test1.usercombo.LOGINID.LOGINID.toArray}" />
</h:selectOneMenu>
<hx:behavior event="onchange" target="menu1" behaviorAction="get"
targetAction="box1"></hx:behavior>
and also i am declaring a requestParam type variable named city;
and at the onChangeEvent i am writing the code
public void handleMenu1ValueChange(ValueChangeEvent valueChangedEvent) {
FacesContext context = FacesContext.getCurrentInstance();
Map requestScope = ext.getApplication().createValueBinding("#{requestScope}").getValue(context);
requestScope.put("login",(String)valueChangedEvent.getNewValue());
and also i am creating another SDO which is used to populate data in datatable and in this SDO in the where clause i am using that requestParam .
it is assigning value in the pageCode variable and in the requestParam but it is not populating the dataTable. i don't no why??
it is possible that i may not clear at this point.
please send me the way how my problem can be solved.
thanks in advance -
I am developing a desktop application in Wpf using MVVM and Entity Frameworks. I have the following tables:
1. Party (PartyId, Name)
2. Case (CaseId, CaseNo)
3. Petitioner (CaseId, PartyId) ............. Link Table
I am completely new to .Net and to begin with I download Microsoft's sample application and
following the pattern I have been successful in creating several tabs. The problem started only when I wanted to implement many-to-many relationship. The sample application has not covered the scenario where there can be a any-to-many relationship. However
with the help of MSDN forum I came to know about a link table and managed to solve entity framework issues pertaining to many-to-many relationship. Here is the screenshot of my application to show you what I have achieved so far.
And now the problem I want the forum to address is how to bind a combo box so that it retrieves Party.Name for the corresponding PartyId in the Link Table and also I want to populate it with Party.Name so that
users can choose one from the dropdown list to add or edit the petitioner.Hello Barry,
Thanks a lot for responding to my query. As I am completely new to .Net and following the pattern of Microsoft's Employee Tracker sample it seems difficult to clearly understand the concept and implement it in a scenario which is different than what is in
the sample available at the link you supplied.
To get the idea of the thing here is my code behind of a view vBoxPetitioner:
<UserControl x:Class="CCIS.View.Case.vBoxPetitioner"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:v="clr-namespace:CCIS.View.Case"
xmlns:vm="clr-namespace:CCIS.ViewModel.Case"
mc:Ignorable="d"
d:DesignWidth="300"
d:DesignHeight="200">
<UserControl.Resources>
<DataTemplate DataType="{x:Type vm:vmPetitioner}">
<v:vPetitioner Margin="0,2,0,0" />
</DataTemplate>
</UserControl.Resources>
<Grid>
<HeaderedContentControl>
<HeaderedContentControl.Header>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<TextBlock Margin="2">
<Hyperlink Command="{Binding Path=AddPetitionerCommand}">Add Petitioner</Hyperlink>
| <Hyperlink Command="{Binding Path=DeletePetitionerCommand}">Delete</Hyperlink>
</TextBlock>
</StackPanel>
</HeaderedContentControl.Header>
<ListBox BorderThickness="0" SelectedItem="{Binding Path=CurrentPetitioner, Mode=TwoWay}" ItemsSource="{Binding Path=tblParties}" />
</HeaderedContentControl>
</Grid>
</UserControl>
This part is working fine as it loads another view that is vPetioner perfectly in the manner I want it to be.
Here is the code of vmPetitioner, a ViewModel:
Imports Microsoft.VisualBasic
Imports System.Collections.ObjectModel
Imports System
Imports CCIS.Model.Party
Namespace CCIS.ViewModel.Case
''' <summary>
''' ViewModel of an individual Email
''' </summary>
Public Class vmPetitioner
Inherits vmParty
''' <summary>
''' The Email object backing this ViewModel
''' </summary>
Private petitioner As tblParty
''' <summary>
''' Initializes a new instance of the EmailViewModel class.
''' </summary>
''' <param name="detail">The underlying Email this ViewModel is to be based on</param>
Public Sub New(ByVal detail As tblParty)
If detail Is Nothing Then
Throw New ArgumentNullException("detail")
End If
Me.petitioner = detail
End Sub
''' <summary>
''' Gets the underlying Email this ViewModel is based on
''' </summary>
Public Overrides ReadOnly Property Model() As tblParty
Get
Return Me.petitioner
End Get
End Property
''' <summary>
''' Gets or sets the actual email address
''' </summary>
Public Property fldPartyId() As String
Get
Return Me.petitioner.fldPartyId
End Get
Set(ByVal value As String)
Me.petitioner.fldPartyId = value
Me.OnPropertyChanged("fldPartyId")
End Set
End Property
End Class
End Namespace
And below is the ViewMode vmParty which vmPetitioner Inherits:
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports CCIS.Model.Case
Imports CCIS.Model.Party
Imports CCIS.ViewModel.Helpers
Namespace CCIS.ViewModel.Case
''' <summary>
''' Common functionality for ViewModels of an individual ContactDetail
''' </summary>
Public MustInherit Class vmParty
Inherits ViewModelBase
''' <summary>
''' Gets the underlying ContactDetail this ViewModel is based on
''' </summary>
Public MustOverride ReadOnly Property Model() As tblParty
'''' <summary>
'''' Gets the underlying ContactDetail this ViewModel is based on
'''' </summary>
'Public MustOverride ReadOnly Property Model() As tblAdvocate
''' <summary>
''' Gets or sets the name of this department
''' </summary>
Public Property fldName() As String
Get
Return Me.Model.fldName
End Get
Set(ByVal value As String)
Me.Model.fldName = value
Me.OnPropertyChanged("fldName")
End Set
End Property
''' <summary>
''' Constructs a view model to represent the supplied ContactDetail
''' </summary>
''' <param name="detail">The detail to build a ViewModel for</param>
''' <returns>The constructed ViewModel, null if one can't be built</returns>
Public Shared Function BuildViewModel(ByVal detail As tblParty) As vmParty
If detail Is Nothing Then
Throw New ArgumentNullException("detail")
End If
Dim e As tblParty = TryCast(detail, tblParty)
If e IsNot Nothing Then
Return New vmPetitioner(e)
End If
Return Nothing
End Function
End Class
End Namespace
And final the code behind of the view vPetitioner:
<UserControl x:Class="CCIS.View.Case.vPetitioner"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="clr-namespace:CCIS.ViewModel.Case"
mc:Ignorable="d"
Width="300">
<UserControl.Resources>
<ResourceDictionary Source=".\CompactFormStyles.xaml" />
</UserControl.Resources>
<Grid>
<Border Style="{StaticResource DetailBorder}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Petitioner:" />
<ComboBox Grid.Column="1" Width="240" SelectedValuePath="." SelectedItem="{Binding Path=tblParty}" ItemsSource="{Binding Path=PetitionerLookup}" DisplayMemberPath="fldName" />
</Grid>
</Border>
</Grid>
</UserControl>
The problem, presumably, seems to be is that the binding path "PetitionerLookup" of the ItemSource of the Combo box in the view vPetitioner exists in a different ViewModel vmCase which serves as an ObservableCollection for MainViewModel. Therefore,
what I need to Know is how to route the binding path if it exists in a different ViewModel?
Sir, I look forward to your early reply bringing a workable solution to the problem I face.
Warm Regards,
Arun
Maybe you are looking for
-
hi all, I am trying to set accelerators to JMenuItems. I am using language english ,german. I have created to property files with english and german. if i get accelerator value as shft s,control n..finally it is showing Umschalt s and Strg n. i am us
-
Elements 13 for a 32 bit pc has been downloaded onto my 64 bit pc so is useless WHAT CAN I DO?
Elements 13 for a 32 bit pc has been downloaded onto my 64 bit pc so is useless WHAT CAN I DO? Please help !!!!
-
FileVault 2 guest account is greyed out
Yesterday I performed a clean install of OS X Lion for my MBP (early 2011) had some kernel panics recently and I was told that it could be a software related problem. Anyway I installed all of the updates, switched on File Vault, Back to my Mac and e
-
I have a comcast.net mail account set up on my ipad2. While checking mail, I delete after reading. However if I quit the application and go back in, everything I just deleted shows back up as new messages. I have my advanced settings set to remove th
-
Échec de la connexion sécurisée pour les modules complémentaires avec Thunderbierd
J'ai TB 24.5.0 en version portable. Quand je vais sur outils->Modules complémentaires j'obtiens l'erreur suivante (copie du texte) : Échec de la connexion sécurisée services.addons.mozilla.org utilise un certificat de sécurité invalide. Le certificat