Curly brackets in variables

Hi guys, here' my problem:
Get-DhcpServerv4OptionValue -ScopeId 172.19.1.0 -all -OptionId 132 | Set-DhcpServerv4OptionValue -ScopeId 172.19.2.0 -Value {0x35, 0x35, 0x32}
work just fine from the powershell prompt.
Import-Csv .\Nodi.csv -Delimiter ";" | foreach {
    if ($_.Value -ne "-") {
        Get-DhcpServerv4OptionValue -ScopeId 172.19.1.0 -all -OptionId 132 | Set-DhcpServerv4OptionValue -ScopeId $_.ScopeID -Value $_.Value
Doesn't work: 
Set-DhcpServerv4OptionValue : Parameters for option value to be set for option ID 132 do not match with option definition on DHCP server SAGA.
At C:\dhcpscripts\Set-ScopeOption43.ps1:6 char:78
+         Get-DhcpServerv4OptionValue -ScopeId 172.19.1.0 -all -OptionId 132 | Set ...
+                                                                        
     ~~~
    + CategoryInfo          : InvalidArgument: (132:root/Microsoft/...erv4OptionValue) [Set-DhcpServerv4OptionValue], CimException
    + FullyQualifiedErrorId : WIN32 87,Set-DhcpServerv4OptionValue
CSV contents:
ScopeId,Value
172.19.2.0,{0x35, 0x35, 0x32}
172.19.3.0,{0x35, 0x35, 0x33}
172.19.4.0,{0x35, 0x35, 0x34}
If I change, in the script, $_.Value with, for example, {0x35, 0x35, 0x32} it works. The problem is passing the value from the CSV file. When inserting Write-Host $_.Value in the script, it display the values correctly with curly brackets.
Any suggestion?
Dario Palermo

Couple of things to note here:
The -Value parameter of the Set-DhcpServer4OptionValue cmdlet accepts an array of strings.
When you type something in curly braces in a PowerShell script (if it's not in quotation marks), you're typically defining a ScriptBlock object.  The literal syntax for these is { <Statements> }.
When you import a CSV file, you're getting strings.  Strings that happen to contain curly braces are still just strings.
When you convert a ScriptBlock object into a string, the curly braces are not included in the string output; only the statements inside it.
Your Import-Csv command mentions a delimiter of ";", but your sample CSV contents have separated the ScopeId and Value fields with commas.  I assume that this was meant to be a semicolon, but commas within the curly braces. 
Is this correct? 
With this in mind, when you run the command locally with -Value { 0x01, 0x02, 0x03 } , what PowerShell is really passing to the command is a string value of " 0x01, 0x02, 0x03 "; the ScriptBlock literal you wrote is converted directly to a string
for you.  If you ran the command with -Value "{ 0x01, 0x02, 0x03 }", you'd probably get the same error that you're seeing during the CSV import.
In order to make this work, you'll need to strip out the curly braces from the CSV data (either directly in the file, or at the time of import; doesn't matter), before calling Set-DhcpServer4OptionValue. Try this:
Import-Csv .\Nodi.csv -Delimiter ";" | foreach {
if ($_.Value -ne "-") {
$value = $_.Value -replace '^\s*{\s*|\s*}\s*$'
Get-DhcpServerv4OptionValue -ScopeId 172.19.1.0 -all -OptionId 132 |
Set-DhcpServerv4OptionValue -ScopeId $_.ScopeID -Value $value
This removes the curly braces (and any leading / trailing whitespace, for good measure) from the input data before passing the string on to Set-DhcpServer4OptionValue.

Similar Messages

  • Curly brackets - can't activate key "8" and "9" with alt+shift ?

    Hi I am using danish keys on my mac book pro and can't activate the keys 8 and 9 with alt+shift, wherefore I can't easily make curly brackets ?
    Have any of you had same problem or do you know a way around it ?
    I know I kan draw a curly bracket, but it is time consuming.
    So if any of you know a trick - I will be thankful.
    BR

    Sounds as if you are misunterstanding me.
    Glyphs are under the Type menu. There you can see all the characters in the selected font.
    With your type active using the Type tool, just double click on the character you want in the Glyphs palette and it will show up.

  • Brackets and variables

    What is the correct syntax for insert a variable into brackets?  I have the following java script.
    var tcount = Subform2.instanceManager.count - 1
    xfa.host.resetData("form1.Subform1.Subform2[tcount]");
    tcount
    returns 0 (checked with text field)
    and
    xfa.host.resetData("form1.Subform1.Subform2[0]");
    properly executes a reset.
    but
    xfa.host.resetData("form1.Subform1.Subform2[tcount]");
    fails
    any ideas?
    Thank you!
    Tyler

    Since tcount is a variable you need to keep it outside of the double quotes.
    xfa.host.resetData("form1.Subform1.Subform2[" + tcount + "]");
    Thanks
    Srini

  • Goddam Curly Brackets!!!

    HELP!
    I'm having problems finding a missing or extra bracket within my code? Or at least I thik that is the problem.
    The error I get is:
    <----
    270. try
    542. }
    --------^
    *** Syntax Error: "Finally" inserted to complete TryStatement
    I've tried using comparison software but it doesn't help!
    I have attached the section of code that is causing the problem, but I think it may be deeped that just the following section.
    All the brackes "seem" to match, but 271 goes to 501 in theory, but when I rightclick in my software (JCreator) and choose match bracket, it takes me to 531?
    Anyhelp please!! Be most grateful!
    See Attached Code:
    try
         //System.out.println("Here 1");
    * Check to see if Activity Option 'LABEL' is present. If it is not throw an exception.
    * I think this could be where LABEL should be a user configured variable (map)
    * Either here or above on line 109. (map) (then again maybe not!!!)
    if (label_tmp == null)
    abortMissingInput("Activity Option 'LABELREF'");
    System.out.println("Here 2");
    else
    //     System.out.println("Here 3");
    * Check to see if the nicelabel file already exists. If it does
    * then we need to write the data into a temporary file.
    // cam removed
    // while(out.exists())
    // cam removed
    // System.out.println("Here 4");
    * Build data for updating the next_number table. Before that happens we need to
    * verify that the SFCs do not already exist in wip, if they do then we need to generate
    * a new batch
    /* map - Fix Rev 1.2 */
    System.out.println("Label TMP "+label_tmp);
    System.out.println("SFC Number "+SFCNumber);
    if (label_tmp.equals("SB"))
    /* map - Fix 1 Rev 1.2 */
         System.out.println("Here 5");
         requestConnection();
         try
         ItemBOHandle itembo = new ItemBOHandle(site,"*","*");
         nbBO = new NextNumberBOHandle(site,"S",itembo);
         StringBuffer next_number_query = new StringBuffer();
         next_number_query.append("SELECT current_sequence,prefix,suffix from next_number ");
         next_number_query.append("where HANDLE=");
         next_number_query.append(wrap(nbBO));
         Data number_query = executeQuery(next_number_query.toString());
         current_seq = (BigDecimal)number_query.get("CURRENT_SEQUENCE");
         prefix = (String)number_query.get("PREFIX");
         suffix = (String)number_query.get("SUFFIX");
         long sfc_seq = current_seq.longValue();
         first_sfc = current_seq.longValue();
                                  int array_length = big.intValue();
         * Build an array to create the next SFC numbers. This information will
         * be used to select from the sfc table. If any of the SFCs in the array
         * are found, a new block should be generated.
         * I think this is where it implements the current sfc by 1. (map)
         new_sfc = new String[array_length];
         * map fix Rev 1.2 - loop until SFC_NBR test has been passed
         System.out.println("Here 8a1");
         if (Serialize == -1);
         /* map added do statement */
              do
         //while (Serialize == -1);
         System.out.println("Here 9");
         * map fix Rev 1.2
              for (int i=0;i<array_length;i++)
              if (suffix == null)
              new_sfc[i] = prefix+sfc_seq;
              else
              new_sfc[i] = prefix+sfc_seq+suffix;
              sfc_seq++;
              System.out.println(new_sfc);
              * Using the data we have generated above we need to check the SFC table.
              int new_sfc_array;
              new_sfc_array = new_sfc.length;
              for (int j=0;j<new_sfc_array;j++)
                   System.out.println("Here 10");
              StringBuffer find_sfc = new StringBuffer();
              find_sfc.append("SELECT count(*) from sfc where ");
              find_sfc.append("sfc=");
              find_sfc.append(wrap(new_sfc[j]));
              System.out.println(find_sfc.toString());
              AreYouThere = executeQuery(find_sfc.toString());
              System.out.println("AreYouThere: "+AreYouThere);
              there_count = (BigDecimal)AreYouThere.get("COUNT(*)");
              //int array_length = big.intValue();
              System.out.println("Valueof There_count: "+there_count);
              int test = there_count.intValue();
              if (test > 0)
              System.out.println("The sfc is already in use : "+new_sfc);
              // We need a new block of sfc's one is already in use. Once we do that
              BigDecimal doubled = new BigDecimal(2);
              old_big = big;
              big=big.multiply(doubled);
              verify = true;
              break;
              if (Serialize == -1);
                   break;
              // System.out.println("Data Returned from SFC select: "+AreYouThere);
              Serialize = 0;
         * map fix Rev 1.2
         //this it my bracket below while searching for the missing one!!!!!!!!!!!
              /* map added line below */
              while (Serialize == -1);
         * map fix Rev 1.2
         current_seq = current_seq.add(big);
         //System.out.println(now);
         System.out.println("Update sequence number: "+current_seq);
         // map commented this out as it is not set properly and will not compile.
         //java.util.Date now = new java.util.Date();
         //java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("dd-MM-yy");
         //String time =formatter.format;
         /* Update the next_number table. Should be doing this using the CRUD methods, but didn't have time
         * to figure them out.
         StringBuffer update_next_number = new StringBuffer();
         update_next_number.append("UPDATE next_number set ");
         update_next_number.append("current_sequence="+wrap(current_seq)); /*+", "); */
         //update_next_number.append("modified_date_time="+wrap(time)+" ");
         update_next_number.append("where HANDLE="+wrap(nbBO));
         System.out.println("Update Next Number SQL: "+update_next_number);
         System.out.println("Executing update");
         executeUpdate(update_next_number.toString());
              finally
         cleanup();
    /* map - Fix 1 */
         System.out.println("After Allocate SFC");
         /* map - Fix 1 */
    /* This is where it actually writes the label and its contents.
    * I also think its where it should be queuing the next label and not trying
    * to overwrite it, like it does currently. (map)
         //File out = new file(file_time)
              /* map change Rev 1.3*/
              //sb.append(order_id+","+pos_id+","+spcode+","+pack+","+imei_number+","+final_template);
              /* This is the option to use the date as a time stamp.
         SimpleDateFormat formatter = new SimpleDateFormat("ddMMyyHmmss");
         Date currentTime_1 = new Date();
         fileDate = formatter.format(currentTime_1);
              System.out.println("Current Time : "+fileDate);
         file_path = ("C:\\TEMP\\"+fileDate+".Job");      
         out = new File(file_path);
         System.out.println("Output File Name : "+out);
         /* map change Rev 1.3*/
         //map new code...
         PrintWriter out = null;
         try
                   out = new PrintWriter(new BufferedOutputStream(new FileOutputStream("c:/temp/nice.job", true)), true);
                   out.print("LABEL \"");
                   out.print(item);
                   out.print("_");
                   out.print(item_rev);
                   out.print("_");
                   out.print(label_tmp);
                   out.print(".lbl\"");
                   out.println();
                   // All other stuff...
         finally
              try
                   out.close();
              catch(Exception e)
                   System.err.println("Unable to close output stream");
                   e.printStackTrace();
         return inData;

    Cheers, your a star!
    The thing is, I have just been looking throughit after what you said and there seems to be only one catch and 3 trys and before I (fooked) around with it, it worked???
    Here is the code. I think JCreator is not very helpful!!
    Cheers
    package com.genrad.app.core.prod.server;
    import javax.ejb.*;
    import java.rmi.RemoteException;
    import javax.naming.*;
    import javax.sql.DataSource;
    import java.sql.*;
    import java.math.*;
    import java.io.*;
    import java.lang.Thread.*;
    import java.util.*;
    import java.util.Date;
    import java.text.*;
    import javax.transaction.*;
    import com.genrad.frame.*;
    import com.genrad.app.common.server.*;
    import com.genrad.app.nc.server.*;
    import com.genrad.app.core.pd.server.*;
    import com.genrad.app.core.sys.server.*;
    import com.genrad.app.core.track.server.*;
    import com.genrad.app.core.demand.server.*;
    import com.genrad.app.core.env.server.*;
    public class LexisBean extends BasicProductionBean implements SessionBean,LexisInterface
    private final String ACTIVITY_ID = "CT520";
    private final String TRUE = "true";
    private String sfc_info = null;
    private String get_prop_sfc = null;
    private Data Context_List;
    private Data test;
    private Data itemBOrs;
    private String item = null;
    private String item_rev = null;
    private String shoporder = null;
    private Data LotSizeRS;
    private Data results;
    private Data hookData;
    private Data AreYouThere;
    private String printer = null;
    private String label_tmp = null;
    private BigDecimal big;
    private BigDecimal current_seq;
    private String site;
    private String file_path;
    private String file_time;
    private String prefix;
    private String suffix;
    private boolean verify = false;
    private NextNumberBOHandle nbBO;
    private String[] new_sfc;
    private int count=0;
    private BigDecimal there_count;
    private BigDecimal old_big;
    private long first_sfc;
    private int Serialize = -1;
    private String fileDate;
    //private PrintWriter out;
    //private output_file;
    // private StringBuffer buffer;
    * Constructor
    public LexisBean()
    public Data execute(Data inData)throws RemoteException, BasicBOBeanException
    * Need to get all the user options defined in the Activity. The only one that
    * is not required in the printer name. There is no validation done on
    * any of these options.
    * Here I think it should be using the LABELREF User Argument in the Hook Activity
    * within Resource Maintenance. (map)
    String setting = null;
    Utils.traceMsg("LexisBean . execute() : inData \n" + inData.toXMLString(), 10);
    hookData = (Data)inData.get("HOOK_DATA",0);
    Utils.traceMsg("LexisBean . execute() : hookData \n" + hookData.toXMLString(), 10);
    results = (Data)hookData.get("ACTIVITY_OPTION", 0);
    if (results != null)
    String value = null;
    String hookData = null;
    Data countData = null;
    * This should check the setting is not SB, don't pre-allocate SFC, just carry on
    * and pass the current sfcnumber. This is my theory anyway!! (map)
    for (int row = 0; row < results.size(); row++)
    countData=results.extractRow(row);
    setting = (String)countData.get("SETTING", 0);
    value = (String)countData.get("EXEC_UNIT_OPTION", 0);
    if (value != null && value.equals("PRINTER"))
    printer = setting;
    System.out.println("Printer: "+printer);
    if (value != null && value.equals("LABELREF"))
    System.out.println("Value: "+value);
    label_tmp = setting;
    System.out.println("Label TMP: "+label_tmp);
    // Get the SFCBO, as that is the key to getting all the data we need.
    Context_List = (Data)inData.get("CONTEXT_LIST",0);
    item = (Context_List.get("CONTEXT_GBO",0)).toString();
    sfc_info = (inData.get("SFC_BO")).toString();
    //SFCBOInterface sfcBean = (SFCBOInterface)getEJB("SFCBO");
    SFCBOHandle sfcbohand = (SFCBOHandle)inData.get("SFC_BO",0);
    site = sfcbohand.getSite();
    String SFCNumber = sfcbohand.getSFC();
    // Need to grab the filename and full path from a system rule.
    System.out.println("Fixing to try and get the Resource_BO");
    ResourceBOHandle resource = (ResourceBOHandle)inData.get("RESOURCE_BO",0);
    file_path = (String)getSystemRule("INLINE_PRINTING",site,resource);
    File out = new File(file_path);
    System.out.println("FilePath from resource "+file_path);
    // Request connection to the database
    requestConnection();
    try
    * Create a string buffer to build the SQL. Need to do this to
    * get the itemBO from the SFC table. There currently is no method
    * to get this information other than this. At lease not that I
    * know of.
    StringBuffer itemBOquery = new StringBuffer();
    itemBOquery.append("SELECT ITEM_BO FROM SFC ");
    itemBOquery.append("WHERE HANDLE=");
    itemBOquery.append(wrap(sfcbohand));
    itemBOrs = executeQuery(itemBOquery.toString());
    System.out.println("ITEM BO FROM SELECT: "+itemBOrs);
    ItemBOHandle itemBOHandle = new ItemBOHandle((String) itemBOrs.get("ITEM_BO"));
    item = itemBOHandle.getItem();
    item_rev = itemBOHandle.getRevision();
    * Create a string buffer to build the SQL. Need to do this to get
    * ShopOrderBO. This information is actually coming from the
    * shop_order_sfc table. Once we have that it will be used to create
    * the printjobname line in the label file.
    StringBuffer soBOquery = new StringBuffer();
    soBOquery.append("SELECT SHOP_ORDER_BO FROM shop_order_sfc ");
    soBOquery.append("where SFC_BO=");
    soBOquery.append(wrap(sfcbohand));
    Data soBOrs = executeQuery(soBOquery.toString());
    ShopOrderBOHandle shopBOHandle = new ShopOrderBOHandle((String) soBOrs.get("SHOP_ORDER_BO"));
    shoporder = shopBOHandle.getShopOrder();
    * Create a string buffer to build the SQL. Need to do this to get
    * lotsize of an item. I will be getting this information from the
    * item table. Once we have that information it will be used to
    * create the PRINT line in the nicelabel.
    * I think this is where it gets the item lot size and needs to get the sfc lot size,
    * another one of Stuarts bugs...
    StringBuffer LotSize = new StringBuffer();
    LotSize.append("SELECT LOT_SIZE FROM ITEM ");
    LotSize.append("where HANDLE=");
    LotSize.append(wrap(itemBOHandle));
    LotSizeRS = executeQuery(LotSize.toString());
    big = (BigDecimal)LotSizeRS.get("LOT_SIZE");
    System.out.println(LotSize.toString());
    System.out.println("LOTSIZE: "+LotSizeRS);
    finally
    cleanup();
    String sfc = sfcbohand.getSFC();
    * The following try block is an attempt to write the information to
    * the nice label file. It uses several of the string variables defined
    * above.
    try
         //System.out.println("Here 1");
    * Check to see if Activity Option 'LABEL' is present. If it is not throw an exception.
    * I think this could be where LABEL should be a user configured variable (map)
    * Either here or above on line 109. (map) (then again maybe not!!!)
    if (label_tmp == null)
    abortMissingInput("Activity Option 'LABELREF'");
    System.out.println("Here 2");
    else
    //     System.out.println("Here 3");
    * Check to see if the nicelabel file already exists. If it does
    * then we need to write the data into a temporary file.
    // cam removed
    // while(out.exists())
    // cam removed
    // System.out.println("Here 4");
    * Build data for updating the next_number table. Before that happens we need to
    * verify that the SFCs do not already exist in wip, if they do then we need to generate
    * a new batch
    /* map - Fix Rev 1.2 */
    System.out.println("Label TMP "+label_tmp);
    System.out.println("SFC Number "+SFCNumber);
    if (label_tmp.equals("SB"))
    /* map - Fix 1 Rev 1.2 */
         System.out.println("Here 5");
         requestConnection();
         try
         ItemBOHandle itembo = new ItemBOHandle(site,"*","*");
         nbBO = new NextNumberBOHandle(site,"S",itembo);
         StringBuffer next_number_query = new StringBuffer();
         next_number_query.append("SELECT current_sequence,prefix,suffix from next_number ");
         next_number_query.append("where HANDLE=");
         next_number_query.append(wrap(nbBO));
         Data number_query = executeQuery(next_number_query.toString());
         current_seq = (BigDecimal)number_query.get("CURRENT_SEQUENCE");
         prefix = (String)number_query.get("PREFIX");
         suffix = (String)number_query.get("SUFFIX");
         long sfc_seq = current_seq.longValue();
         first_sfc = current_seq.longValue();
                                  int array_length = big.intValue();
         * Build an array to create the next SFC numbers. This information will
         * be used to select from the sfc table. If any of the SFCs in the array
         * are found, a new block should be generated.
         * I think this is where it implements the current sfc by 1. (map)
         new_sfc = new String[array_length];
         * map fix Rev 1.2 - loop until SFC_NBR test has been passed
         System.out.println("Here 8a1");
         if (Serialize == -1);
         /* map added do statement */
              do
         //while (Serialize == -1);
         System.out.println("Here 9");
         * map fix Rev 1.2
              for (int i=0;i<array_length;i++)
              if (suffix == null)
              new_sfc[i] = prefix+sfc_seq;
              else
              new_sfc[i] = prefix+sfc_seq+suffix;
              sfc_seq++;
              System.out.println(new_sfc);
              * Using the data we have generated above we need to check the SFC table.
              int new_sfc_array;
              new_sfc_array = new_sfc.length;
              for (int j=0;j<new_sfc_array;j++)
                   System.out.println("Here 10");
              StringBuffer find_sfc = new StringBuffer();
              find_sfc.append("SELECT count(*) from sfc where ");
              find_sfc.append("sfc=");
              find_sfc.append(wrap(new_sfc[j]));
              System.out.println(find_sfc.toString());
              AreYouThere = executeQuery(find_sfc.toString());
              System.out.println("AreYouThere: "+AreYouThere);
              there_count = (BigDecimal)AreYouThere.get("COUNT(*)");
              //int array_length = big.intValue();
              System.out.println("Valueof There_count: "+there_count);
              int test = there_count.intValue();
              if (test > 0)
              System.out.println("The sfc is already in use : "+new_sfc);
              // We need a new block of sfc's one is already in use. Once we do that
              BigDecimal doubled = new BigDecimal(2);
              old_big = big;
              big=big.multiply(doubled);
              verify = true;
              break;
              if (Serialize == -1);
                   break;
              // System.out.println("Data Returned from SFC select: "+AreYouThere);
              Serialize = 0;
         * map fix Rev 1.2
         //this it my bracket below while searching for the missing one!!!!!!!!!!!
              /* map added line below */
              while (Serialize == -1);
         * map fix Rev 1.2
         current_seq = current_seq.add(big);
         //System.out.println(now);
         System.out.println("Update sequence number: "+current_seq);
         // map commented this out as it is not set properly and will not compile.
         //java.util.Date now = new java.util.Date();
         //java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("dd-MM-yy");
         //String time =formatter.format;
         /* Update the next_number table. Should be doing this using the CRUD methods, but didn't have time
         * to figure them out.
         StringBuffer update_next_number = new StringBuffer();
         update_next_number.append("UPDATE next_number set ");
         update_next_number.append("current_sequence="+wrap(current_seq)); /*+", "); */
         //update_next_number.append("modified_date_time="+wrap(time)+" ");
         update_next_number.append("where HANDLE="+wrap(nbBO));
         System.out.println("Update Next Number SQL: "+update_next_number);
         System.out.println("Executing update");
         executeUpdate(update_next_number.toString());
              finally
         cleanup();
    /* map - Fix 1 */
         System.out.println("After Allocate SFC");
         /* map - Fix 1 */
    /* This is where it actually writes the label and its contents.
    * I also think its where it should be queuing the next label and not trying
    * to overwrite it, like it does currently. (map)
         //File out = new file(file_time)
              /* map change Rev 1.3*/
              //sb.append(order_id+","+pos_id+","+spcode+","+pack+","+imei_number+","+final_template);
              /* This is the option to use the date as a time stamp.
         SimpleDateFormat formatter = new SimpleDateFormat("ddMMyyHmmss");
         Date currentTime_1 = new Date();
         fileDate = formatter.format(currentTime_1);
              System.out.println("Current Time : "+fileDate);
         file_path = ("C:\\TEMP\\"+fileDate+".Job");      
         out = new File(file_path);
         System.out.println("Output File Name : "+out);
         /* map change Rev 1.3*/
         //map new code...
         PrintWriter out = null;
         try
                   out = new PrintWriter(new BufferedOutputStream(new FileOutputStream("c:/temp/nice.job", true)), true);
                   out.print("LABEL \"");
                   out.print(item);
                   out.print("_");
                   out.print(item_rev);
                   out.print("_");
                   out.print(label_tmp);
                   out.print(".lbl\"");
                   out.println();
                   // All other stuff...
         finally
              try
                   out.close();
              catch(Exception e)
                   System.err.println("Unable to close output stream");
                   e.printStackTrace();
         return inData;

  • Format curly brackets in an exitising project

    Hi
    I have a semi big project, where the brackets style is all messed up, different syles all over the place.
    I worked in FDT long time ago. Here there was a place where you could format the brackets in exitisting files. (Not talking about the new code i write but exitisting)
    I found an addon called flex formater, but I dont seem to be able to change exitisting code.
    Any ideas?

    Hi thanks for your answer, but that only correct indentation, that not helping with the brackets.
    This is how much of the code is:
    someFunciton()
         blah;
    somOtherFunciton(){
         blah;
    This is how I would like it to be.
    someFunciton()
         blah;
    somOtherFunciton()
         blah;

  • Bug report: text between curly brackets deleted when posting via e-mail

    Title says it all.
    For example, this happened to me here: http://forums.adobe.com/message/2996053

        report message
            CALL METHOD lo_message_manager->report_error_message
              EXPORTING
                message_text = lv_message_string.
            EXIT.
    your EXIT statement will get you out of the loop. rest of the records in internal table will nto be read

  • Some help passing values

    Maybe it's because Im so tired, but I am having a horrible day trying to run anything in more than one method.
    I set everything as public, so I don't know what I am doing wrong.
    import java.io.*;
    import java.util.*;
        public class mainMenu extends CalcSalesTax{
        public static int UI()throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
             int selected = Integer.parseInt(input.readLine());
             double total = 0;
             public static void Menu(){
             System.out.println("Please Select:");
             System.out.println("1: to Calculate Tax");
             System.out.println("or");
             System.out.println("0 to Exit");
             selected = Integer.parseInt(input.readLine());
             return selected;
            public static  void main(String[] args)throws Exception {
            selected = UI();
            BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
            while (selected==1){
             switch(selected){
             case 0:
             return;
             case 1:
             salesTax();
             break;
    }I am getting errors like, cannot find "selected"... please help me out... is it a syntax thing?

    For better guidance, you will need to post your code for the superclass CalcSalesTax as we cannot guess what class / instance fields and methods it has.
    I think you have a problem with understanding the scope of variables. Take a quick look at
    {color:#0000ff}http://home.cogeco.ca/~ve3ll/jatutor2.htm#st{color}
    Execution blocks are the sections of code that start and end with curly brackets. Variables maintain their definition (or 'scope') until the end of the execution block that they are defined in.
    FWIW I have reworked your code, but I expect you to ask about the changes you don't understand -- and post the updated code for both MainMenu and CalcSalesTax and any superclass/es of CalcSalesTax.import java.io.*;
    import java.util.*;
    public class MainMenu extends CalcSalesTax {
       int selected = 1;
       BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
       public MainMenu () {
          while (selected == 1) {
             menu ();
             switch (selected) {
                case 0:
                   System.exit (0);
                case 1:
                   salesTax(); // mehod in super class ?
       private void menu () {
          System.out.println("Please Select:\n1: to Calculate Tax\nor\n0 to Exit");
          String inString = input.readLine()
          try {
             selected = Integer.parseInt(inString);
          } catch (NumberFormatException ex) {
             selected = 0;
             ex.printStackTrace ();
       public static void main (String[] args) throws Exception {
          MainMenu mainMenu = new MainMenu ();
    }Disclaimer: I don't have a JDK on this office machine, so there may be typos in the code posted.
    db
    Edited by: Darryl.Burke to remove whatever typos I could spot.

  • No curly or square brackets in xorg in Swedish keyboard layout

    Hi!
    I'm using the Swedish keyboard layout in xorg (se), but the curly och square brackets does not seem to be displayed as they should.
    When I enter AltGr + 7, I should get a curly bracket ( { ), but now it gives me a û.  AltGr + 8 equals a Û (should be [ ), AltGr + 9 equals ý (should be ] ) and AltGr + 0 equals Ý (should be } ).
    Here's my xorg.conf for the Keyboard input device:
    Section "InputDevice"
    Identifier "Keyboard0"
    Driver "kbd"
    Option "XkbModel" "logiultrax"
    Option "XkbLayout" "se"
    EndSection
    Anyone have a clue what's going on?
    Last edited by mei (2009-02-03 00:23:18)

    mei wrote:
    Hi!
    I'm using the Swedish keyboard layout in xorg (se), but the curly och square brackets does not seem to be displayed as they should.
    When I enter AltGr + 7, I should get a curly bracket ( { ), but now it gives me a û.  AltGr + 8 equals a Û (should be [ ), AltGr + 9 equals ý (should be ] ) and AltGr + 0 equals Ý (should be } ).
    Here's my xorg.conf for the Keyboard input device:
    Section "InputDevice"
    Identifier "Keyboard0"
    Driver "kbd"
    Option "XkbModel" "logiultrax"
    Option "XkbLayout" "se"
    EndSection
    Anyone have a clue what's going on?
    Check your /etc/rc.conf so that you've set your locale and keymap right, that part of my rc.conf:
    LOCALE="sv_SE.UTF-8"
    HARDWARECLOCK="UTC"
    USEDIRECTISA="no"
    TIMEZONE="Europe/Stockholm"
    KEYMAP="sv-latin1"
    As for xorg.conf, I'm actually running completely without it. Which I could recommend as long as you're not using the proprietary drivers from NVidia or ATI or so.

  • Error when using running total variable in formula

    This is probably an easy syntax problem, but I'm fairly new to Crystal reporting.  I created a running total variable (count) called InquiryTypeSubtotal that simply counts the number of records.  I have one grouping level, and in the group footer I'd like to print a line showing the total count for that group that looks like
    Total inquiries for Assistive Technology: 3
    To accomplish this I'm using a formula field with the following syntax:
    "Total inquiries for " + {CnAttrCat_1.CnAttrCat_1_Description} + ": " + ToText(@InquiryTypeSubtotal)
    When I try to check the formula, I get the error message "The ) is missing."  What am I doing wrong?
    Thanks,
    Alec

    I put in the curly brackets so my formula now reads
    "Total inquiries for " + {CnAttrCat_1.CnAttrCat_1_Description} + ": " + ToText({@InquiryTypeSubtotal})
    Now when I check the formula I get the error message "This field name is not known."
    Alec

  • Error when using replacement path variable in exception range

    I'm trying produce a check report that produces exception highlighting based on a range determined by the associated characteristic.
    eg.
    For Check 1, highlight cells in red where the associated key figure is between 1 and 999.
    For Check 2, highlight cells in amber where the associated key figure is between -999 and -1.
    Now, I know that the lower and upper limit of an exception can be populated by a formula variable. However, when I create a formula variable that uses a replacement path to fetch the limit values from the associated Check and use that in the exception, the query errors when I try to run it:
    System Error: 'Variable name ( technical name ) does not exist or is incorrectly used 4 New Exception.'
    The error long text suggests that the variable is being used incorrectly, even though it says for Formula variables:
    ... can be used in all cases. Note: Formula variables can have units or be without them. Incorrect use can also arise here since the system always calculates in accordance with the units. Formula variables can also be used to create the upper and lower limits in exceptions.
    In this case, the formula variable does not have units.
    Interestingly, but equally unhelpfully, if a regular constant is used instead of a formula variable for the lower limit, but a formula variable is still used for the upper limit, the error message changes to:
    System error in program SAPLRRI2 and form FAC_VAR_IN_VREP_INSERT-1-
    The query works if the formula variable simply holds a default value, so the problem clearly appears to be with replacement path. If BEx doesn't support replacement path formula variables in exceptions, then aside from the fact that it would be useful if that was stated in the errors, what alternatives, if any, deliver the functionality of exception ranges that change depending on the corresponding characteristic.

    I put in the curly brackets so my formula now reads
    "Total inquiries for " + {CnAttrCat_1.CnAttrCat_1_Description} + ": " + ToText({@InquiryTypeSubtotal})
    Now when I check the formula I get the error message "This field name is not known."
    Alec

  • Passing Global Variable in Sql Object

    Hi
    How can i pass my global variable into SQL object? I tried to pass it but then I tried to update the schema it giving me the error at varble
    Please advise me

    The Update schema is used only to get the structure for the Output.
    Once you have a valid structure and the SQL Parses without any variables use the syntax for applying variables as in any Script within DI.
    $GV_MyVar enclosed within square brackets will be replaced by Value of the variable.
    $GV_MyVar enclosed within curly brackets will be replaced by Value of the variable enclosed in single quotes.
    When the job runs, the variables will be replaced with values OR values with quotes. It is at this time, the SQL send to the database is validated for syntax.
    Therefore, you will not know the validity of your SQL with Global Variables until you run the job.
    Hope this helps!
    Thanks & Regards
    Tiji
    Edited by: Tiji Mathew on May 8, 2009 3:40 PM
    The actual syntax was being posted as a link. edited to make the text descriptive.

  • Bad bind variable & best practice for delete

    I am working with three tables and very new to SQL. I need to create a procedure that will accept an ID and go through two sub tables and delete child records. Item is the main table. I am passing in the ID into the procedure and I want to use it as below. I keep getting a bad bind variable error message. I have verified that the table is setup as a number and my procedure accepts a number. I also want someone to review this from best practice as I am new to procedures.
    PROCEDURE DeleteItem (p_ItemID IN NUMBER, p_RowsAffected OUT number)
    IS
    p_RowsAffected NUMBER;
    -- select the itemdetail for the analysis
    CURSOR c_itemdetail
    IS
    SELECT
    itemdetailid
    FROM itemDETAIL
    WHERE itemid = :p_ItemID;
    BEGIN
    -- loop through each itemdetail and delete the itemdetailoutlay
    FOR r_itemdetail IN c_itemdetail
    LOOP
    BEGIN
    DELETE FROM ITEMDETAILOUTLAY
    WHERE itemdetailid = r_itemdetail.itemdetailid;
    COMMIT;
    END;
    END LOOP;
    -- delete the itemdetail
    BEGIN
    DELETE FROM ITEMDETAIL
    WHERE itemid = :p_ItemID;
    COMMIT;
    END;
    -- delete the main item
    BEGIN
    DELETE FROM ITEM
    WHERE itemdid = :p_ItemID;
    COMMIT;
    p_RowsAffected := SQL%ROWCOUNT;
    END;
    END DeleteItem;

    Hi,
    Welcome to the forum!
    As you may notice, this site normally compresses white-space. Whenever you post code, or any formatted text, on this site, type these 6 characters:
    \(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
    I don't think you mean to use bind variables anywhere, so don't use colons before any variable names.  You were doing this correctly with p_RowsAffected; do the same thing with p_ItemID.
    Try this:PROCEDURE DeleteItem (p_ItemID IN NUMBER, p_RowsAffected OUT number)
    IS
    -- p_RowsAffected NUMBER;     -- Don't name local variables the same as arguments
    -- select the itemdetail for the analysis
    CURSOR c_itemdetail
    IS
    SELECT
    itemdetailid
    FROM itemDETAIL
    WHERE itemid = p_ItemID;     -- No : before p_ItemID
    BEGIN
    -- loop through each itemdetail and delete the itemdetailoutlay
    FOR r_itemdetail IN c_itemdetail
    LOOP
    BEGIN
    DELETE FROM ITEMDETAILOUTLAY
    WHERE itemdetailid = r_itemdetail.itemdetailid;
    COMMIT;
    END;
    END LOOP;
    -- delete the itemdetail
    BEGIN
    DELETE FROM ITEMDETAIL
    WHERE itemid = p_ItemID;     -- No : before p_ItemID
    COMMIT;
    END;
    -- delete the main item
    BEGIN
    DELETE FROM ITEM
    WHERE itemdid = p_ItemID;     -- No : before p_ItemID
    COMMIT;
    p_RowsAffected := SQL%ROWCOUNT;
    END;
    END DeleteItem;
    The most important "best practice" with PL/SQL is to avoid doing it whenever possible. 
    If SQL offers a way o do the same thing, it's usally best not to code anything in PL/SQL.
    Have you considered foreign key constraints, with "ON DELETE CASCADE"?  That way, you could simply "DELETE FROM item", and all the dependent rows in the other tables would automatically be deleted.   You wouldn't need to remember to call a procedure like this; in fact, you would have no need for a procedure like this.
    Given that you do have such a procedure:
    You're doing row-by-row processing, which some mad wags like to call "slow-by-slow" processing.
    For example, iYou're xplicitly finding each ItemDetailID separately, and deleting each one separately, like this:... CURSOR c_itemdetail
    IS
    SELECT
    itemdetailid
    FROM itemDETAIL
    WHERE itemid = p_ItemID;
    -- loop through each itemdetail and delete the itemdetailoutlay
    FOR r_itemdetail IN c_itemdetail
    LOOP
    BEGIN
    DELETE FROM ITEMDETAILOUTLAY
    WHERE itemdetailid = r_itemdetail.itemdetailid;
    COMMIT;
    END;
    END LOOP;
    It's more efficient for the system (and less coding for you) if you let SQL handle as much as possible, so do this instead...     DELETE FROM ItemDetailOutlay
         WHERE ItemDetailID IN
              ( SELECT itemdetailid
              FROM     itemDETAIL
              WHERE     itemid     = p_ItemID
    Do you really want to COMMIT 3 times?  0 or 1 times might be better.
    What happens if there is some kind of error, say, after you've delete rows form ItemDetailOutlay and ItemDetail, but before you've delete from Item?  Wouldn't you want the entire transaction to fail, and leave all three tables in a consistent state?  If so, either have the calling procedure COMMIT, or have a single COMMIT at the end of DelteItem.
    Edited by: Frank Kulash on May 6, 2010 2:25 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to use variable in source path of an image  in flex

    hello
    i just want to know that how to use variable in source path
    of an image in flex

    I am doing exactly that with data binding at the moment. This
    is my Image element
    <mx:Image width="50" minHeight="50" height="76"
    source="{Application.application.parameters.api}/rest/entity/{data.Slug}/Image"
    />
    Note the curly brackets
    HTH
    Pat

  • Possible to use local variables in Calculation Manager

    Hi,
    I'm using calculation manager in EPMA for the first time. Have not found any function for using "local variables", i.e. variables that can be used for fixing on the current members a user has selected in a form. Do someone know if it is possible to use that functionality in calculation manager? And in that case, how do I find it?
    Thanks!
    Regards
    Mats

    Hi,
    I guess you are referring to local variables in Essbase Administration Console. When you are in calculation manager (System View), you can go to Tools->Variables. There you can create variables at application, database (global) or business rule level (local variable). You can use these in Business rules by placing the name in curly bracket {...}.
    The usage of the variables in the forms is the same as before.
    If however, what you meant to say by local variables is substitution variables, yes you can use them in Calc manager the same way you use in calc script.
    Cheers,
    Alp

  • How do I declare the extra variable?

    List the customer number, name, (first and last), order number, order date, employee number, employee, name (first and last), product number, product name, and order cost, (orderline.qty*prodprice) for products ordered on January 23, 2009
    I have no column called order cost in any tables. How do I declare a new variable called order cost in the query? And to date line is missing a right parenthesis. The exact line worked with a different question but accept that I have added on the date in this line.
    SELECT C.CUSTNO, C.CUSTFIRSTNAME, C.CUSTLASTNAME, O.ORNO, O.ORDDATE, E.EMPNO, E.EMPFIRSTNAME, E.EMPLASTNAME, P.PRODNO, P.PRODNAME, L.PRODNO, L.QTY, Order_cost
    From Customer c, Orders o, ORDERLINE L, Employee e, Product P
    where(C.CUSTNO=O.CUSTNO) and(O.EMPNO = E.EMPNO) and (O.ORDNO = L.ORDNO) and (P.PRODNO = L.PRODNO) and Order_cost= (L.QTY*ProdPrice)
    and (o.OrdDate >= to_date('23/01/2009', 'dd/'mm/yyyy') and o.OrdDate <= add_months(to_date('23/01/2009','dd/'mm/yyyy'),+1)-1);
    Thanks.

    Hi,
    user9164240 wrote:
    List the customer number, name, (first and last), order number, order date, employee number, employee, name (first and last), product number, product name, and order cost, (orderline.qty*prodprice) for products ordered on January 23, 2009
    I have no column called order cost in any tables. How do I declare a new variable called order cost in the query? And to date line is missing a right parenthesis. The exact line worked with a different question but accept that I have added on the date in this line.
    SELECT C.CUSTNO, C.CUSTFIRSTNAME, C.CUSTLASTNAME, O.ORNO, O.ORDDATE, E.EMPNO, E.EMPFIRSTNAME, E.EMPLASTNAME, P.PRODNO, P.PRODNAME, L.PRODNO, L.QTY, Order_cost
    From Customer c, Orders o, ORDERLINE L, Employee e, Product P
    where(C.CUSTNO=O.CUSTNO) and(O.EMPNO = E.EMPNO) and (O.ORDNO = L.ORDNO) and (P.PRODNO = L.PRODNO) and Order_cost= (L.QTY*ProdPrice)
    and (o.OrdDate >= to_date('23/01/2009', 'dd/'mm/yyyy') and o.OrdDate <= add_months(to_date('23/01/2009','dd/'mm/yyyy'),+1)-1);Never write, let alone post, unformatted code.
    Format your code so that it's easy to see (among other things) that
    (1) the arguments to TO_DATE match each other, and
    (2) parentheses are balanced.
    For example:
    SELECT      C.CUSTNO
    ,      C.CUSTFIRSTNAME
    ,      C.CUSTLASTNAME
    ,      O.ORNO
    ,      O.ORDDATE
    ,      E.EMPNO
    ,     E.EMPFIRSTNAME
    ,     E.EMPLASTNAME
    ,     P.PRODNO
    ,     P.PRODNAME
    ,     L.PRODNO
    ,     L.QTY
    ,     L.QTY * ProdPrice     AS Order_cost
    From      Customer     c
    ,     Orders           o
    ,     ORDERLINE     L
    ,     Employee     e
    ,     Product          P
    where     (C.CUSTNO     = O.CUSTNO)
    and     (O.EMPNO      = E.EMPNO)
    and      (O.ORDNO      = L.ORDNO)
    and      (P.PRODNO      = L.PRODNO)
    and      (o.OrdDate      >= to_date ( '23/01/2009'
                           , 'dd/'mm/yyyy'          -- WRONG!  Look at alignment
    and      o.OrdDate      <= add_months ( to_date ( '23/01/2009'
                                  , 'dd/'mm/yyyy'     -- WRONG!  Look at alignment
                              , +1
                              ) -1
    )                    -- Extra right parentheses
    ;When you post formatted text on this site, type these 6 characters
    \(all small letters, inside curly brackets) before and after each section of formatted text.  If you don't, this site will not show all the extra spaces.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for

  • Hot Synch problems with cradle and Palm Vx

    I had to hard boot my Palm Vx for digitizing errors.  Now I can't get the pda and Hot Synch Manager to work. How do I set up the pda so if talks to the Palm 414EN.exe desktop download.  I have the old cradle attached to a serial port on my work PC. T

  • Error on microsoft login page for OpenId authentication using Azure AD

    We have implemented authentication for multi tenant SaaS solution which uses Azure Ad single sign on using OpenIdConnect authentication and its working fine. The problem is when user is logged in in azure management portal with his live account and i

  • What happened to the Titanium in ThinkPad T Series? Bring it back!

    I have owned seven T series ThinkPads in my life, and I have converted to MacBook Pro. Why has Lenovo removed the titanium from the T61? IBM had named the T series for its titanium. That is where the T had come from. They have said that they have rem

  • Creating a alias or a new folder is blocked

    I have a MM as headless server. It has two users both with admin rights. I am working in the folder Library/application support/X It refuses to let me create more folders in folder X or any aliases for that matter. Anybody knows how to get this chang

  • Anyone have an iTunes Library/Media on a NAS and no longer can access it on Lion?

    My Buffalo Linkstation is accessable through finder just fine. I can see all fies and have the correct permissions. In iTunes, when i try to use the Option+Click to open iTunes and point it to my NAS library, it does not connect with the permissions