No parameter value is acceptable to the compiler ! Help !

Dear People,
I am trying to do a program that creates a canvas, a bouncing ball with a ball demo. For some reason when I try to put a color as one of the parameters for a BouncingBall I get an error message:
"Variable green not found in class"
But no matter what color I put for a parameter I get a similar
error message.
Below is my driver class where the error occurs, then the other classes
Thank you in advance
Stan
public class TryBouncingBalls
public static void main(String[] args)
Canvas myCanvas = new Canvas("Creativity at its best");
BouncingBall myBouncingBall = new BouncingBall(500,500,50, green, 800, myCanvas);BallDemo myBallDemo = new BallDemo();
import java.awt.*;
import java.awt.geom.*;
* Class BallDemo - provides two short demonstrations showing how to use the
* Canvas class.
* @author Michael Kolling and David J. Barnes
* @version 1.0 (23-Jan-2002)
public class BallDemo
private Canvas myCanvas;
* Create a BallDemo object. Creates a fresh canvas and makes it visible.
public BallDemo()
myCanvas = new Canvas("Ball Demo", 600, 500);
myCanvas.setVisible(true);
* This method demonstrates some of the drawing operations that are
* available on a Canvas object.
public void drawDemo()
myCanvas.setFont(new Font("helvetica", Font.BOLD, 14));
myCanvas.setForegroundColor(Color.red);
myCanvas.drawString("We can draw text, ...", 20, 30);
myCanvas.wait(1000);
myCanvas.setForegroundColor(Color.black);
myCanvas.drawString("...draw lines...", 60, 60);
myCanvas.wait(500);
myCanvas.setForegroundColor(Color.gray);
myCanvas.drawLine(200, 20, 300, 50);
myCanvas.wait(500);
myCanvas.setForegroundColor(Color.blue);
myCanvas.drawLine(220, 100, 370, 40);
myCanvas.wait(500);
myCanvas.setForegroundColor(Color.green);
myCanvas.drawLine(290, 10, 320, 120);
myCanvas.wait(1000);
myCanvas.setForegroundColor(Color.gray);
myCanvas.drawString("...and shapes!", 110, 90);
myCanvas.setForegroundColor(Color.red);
// the shape to draw and move
int xPos = 10;
Rectangle rect = new Rectangle(xPos, 150, 30, 20);
// move the rectangle across the screen
for(int i = 0; i < 200; i ++) {
myCanvas.fill(rect);
myCanvas.wait(10);
myCanvas.erase(rect);
xPos++;
rect.setLocation(xPos, 150);
// at the end of the move, draw once more so that it remains visible
myCanvas.fill(rect);
* Simulates two bouncing balls
public void bounce()
int ground = 400; // position of the ground line
myCanvas.setVisible(true);
// draw the ground
myCanvas.drawLine(50, ground, 550, ground);
// crate and show the balls
BouncingBall ball = new BouncingBall(50, 50, 16, Color.blue, ground, myCanvas);
ball.draw();
BouncingBall ball2 = new BouncingBall(70, 80, 20, Color.red, ground, myCanvas);
ball2.draw();
// make them bounce
boolean finished = false;
while(!finished) {
myCanvas.wait(50); // small delay
ball.move();
ball2.move();
// stop once ball has travelled a certain distance on x axis
if(ball.getXPosition() >= 550 && ball2.getXPosition() >= 550)
finished = true;
ball.erase();
ball2.erase();
import java.awt.*;
import java.awt.geom.*;
* Class BouncingBall - a graphical ball that observes the effect of gravity. The ball
* has the ability to move. Details of movement are determined by the ball itself. It
* will fall downwards, accelerating with time due to the effect of gravity, and bounce
* upward again when hitting the ground.
* This movement can be initiated by repeated calls to the "move" method.
* @author Bruce Quig
* @author Michael Kolling (mik)
* @author David J. Barnes
* @version 1.1 (23-Jan-2002)
public class BouncingBall
private static final int gravity = 3; // effect of gravity
private int ballDegradation = 2;
private Ellipse2D.Double circle;
private Color color;
private int diameter;
private int xPosition;
private int yPosition;
private final int groundPosition; // y position of ground
private Canvas canvas;
private int ySpeed = 1; // initial downward speed
* Constructor for objects of class BouncingBall
* @param xPos the horizontal coordinate of the ball
* @param yPos the vertical coordinate of the ball
* @param ballDiameter the diameter (in pixels) of the ball
* @param ballColor the color of the ball
* @param groundPos the position of the ground (where the wall will bounce)
* @param drawingCanvas the canvas to draw this ball on
public BouncingBall(int xPos, int yPos, int ballDiameter, Color ballColor,
int groundPos, Canvas drawingCanvas)
xPosition = xPos;
yPosition = yPos;
color = ballColor;
diameter = ballDiameter;
groundPosition = groundPos;
canvas = drawingCanvas;
* Draw this ball at its current position onto the canvas.
public void draw()
canvas.setForegroundColor(color);
canvas.fillCircle(xPosition, yPosition, diameter);
* Erase this ball at its current position.
public void erase()
canvas.eraseCircle(xPosition, yPosition, diameter);
* Move this ball according to its position and speed and redraw.
public void move()
// remove from canvas at the current position
erase();
// compute new position
ySpeed += gravity;
yPosition += ySpeed;
xPosition +=2;
// check if it has hit the ground
if(yPosition >= (groundPosition - diameter) && ySpeed > 0) {
yPosition = (int)(groundPosition - diameter);
ySpeed = -ySpeed + ballDegradation;
// draw again at new position
draw();
* return the horizontal position of this ball
public int getXPosition()
return xPosition;
* return the vertical position of this ball
public int getYPosition()
return yPosition;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.*;
* Class Canvas - a class to allow for simple graphical
* drawing on a canvas.
* @author Michael Kolling (mik)
* @author Bruce Quig
* @version 1.8 (23.01.2002)
public class Canvas
private JFrame frame;
private CanvasPane canvas;
private Graphics2D graphic;
private Color backgroundColor;
private Image canvasImage;
* Create a Canvas with default height, width and background color
* (300, 300, white).
* @param title title to appear in Canvas Frame
public Canvas(String title)
this(title, 300, 300, Color.white);
* Create a Canvas with default background color (white).
* @param title title to appear in Canvas Frame
* @param width the desired width for the canvas
* @param height the desired height for the canvas
public Canvas(String title, int width, int height)
this(title, width, height, Color.white);
* Create a Canvas.
* @param title title to appear in Canvas Frame
* @param width the desired width for the canvas
* @param height the desired height for the canvas
* @param bgClour the desired background color of the canvas
public Canvas(String title, int width, int height, Color bgColor)
frame = new JFrame();
canvas = new CanvasPane();
frame.setContentPane(canvas);
frame.setTitle(title);
canvas.setPreferredSize(new Dimension(width, height));
backgroundColor = bgColor;
frame.pack();
* Set the canvas visibility and brings canvas to the front of screen
* when made visible. This method can also be used to bring an already
* visible canvas to the front of other windows.
* @param visible boolean value representing the desired visibility of
* the canvas (true or false)
public void setVisible(boolean visible)
if(graphic == null) {
// first time: instantiate the offscreen image and fill it with
// the background color
Dimension size = canvas.getSize();
canvasImage = canvas.createImage(size.width, size.height);
graphic = (Graphics2D)canvasImage.getGraphics();
graphic.setColor(backgroundColor);
graphic.fillRect(0, 0, size.width, size.height);
graphic.setColor(Color.black);
frame.show();
* Provide information on visibility of the Canvas.
* @return true if canvas is visible, false otherwise
public boolean isVisible()
return frame.isVisible();
* Draw the outline of a given shape onto the canvas.
* @param shape the shape object to be drawn on the canvas
public void draw(Shape shape)
graphic.draw(shape);
canvas.repaint();
* Fill the internal dimensions of a given shape with the current
* foreground color of the canvas.
* @param shape the shape object to be filled
public void fill(Shape shape)
graphic.fill(shape);
canvas.repaint();
* Fill the internal dimensions of the given circle with the current
* foreground color of the canvas.
public void fillCircle(int xPos, int yPos, int diameter)
Ellipse2D.Double circle = new Ellipse2D.Double(xPos, yPos, diameter, diameter);
fill(circle);
* Fill the internal dimensions of the given rectangle with the current
* foreground color of the canvas. This is a convenience method. A similar
* effect can be achieved with the "fill" method.
public void fillRectangle(int xPos, int yPos, int width, int height)
fill(new Rectangle(xPos, yPos, width, height));
* Erase the whole canvas.
public void erase()
Color original = graphic.getColor();
graphic.setColor(backgroundColor);
Dimension size = canvas.getSize();
graphic.fill(new Rectangle(0, 0, size.width, size.height));
graphic.setColor(original);
canvas.repaint();
* Erase the internal dimensions of the given circle. This is a
* convenience method. A similar effect can be achieved with
* the "erase" method.
public void eraseCircle(int xPos, int yPos, int diameter)
Ellipse2D.Double circle = new Ellipse2D.Double(xPos, yPos, diameter, diameter);
erase(circle);
* Erase the internal dimensions of the given rectangle. This is a
* convenience method. A similar effect can be achieved with
* the "erase" method.
public void eraseRectangle(int xPos, int yPos, int width, int height)
erase(new Rectangle(xPos, yPos, width, height));
* Erase a given shape's interior on the screen.
* @param shape the shape object to be erased
public void erase(Shape shape)
Color original = graphic.getColor();
graphic.setColor(backgroundColor);
graphic.fill(shape); // erase by filling background color
graphic.setColor(original);
canvas.repaint();
* Erases a given shape's outline on the screen.
* @param shape the shape object to be erased
public void eraseOutline(Shape shape)
Color original = graphic.getColor();
graphic.setColor(backgroundColor);
graphic.draw(shape); // erase by drawing background color
graphic.setColor(original);
canvas.repaint();
* Draws an image onto the canvas.
* @param image the Image object to be displayed
* @param x x co-ordinate for Image placement
* @param y y co-ordinate for Image placement
* @return returns boolean value representing whether the image was
* completely loaded
public boolean drawImage(Image image, int x, int y)
boolean result = graphic.drawImage(image, x, y, null);
canvas.repaint();
return result;
* Draws a String on the Canvas.
* @param text the String to be displayed
* @param x x co-ordinate for text placement
* @param y y co-ordinate for text placement
public void drawString(String text, int x, int y)
graphic.drawString(text, x, y);
canvas.repaint();
* Erases a String on the Canvas.
* @param text the String to be displayed
* @param x x co-ordinate for text placement
* @param y y co-ordinate for text placement
public void eraseString(String text, int x, int y)
Color original = graphic.getColor();
graphic.setColor(backgroundColor);
graphic.drawString(text, x, y);
graphic.setColor(original);
canvas.repaint();
* Draws a line on the Canvas.
* @param x1 x co-ordinate of start of line
* @param y1 y co-ordinate of start of line
* @param x2 x co-ordinate of end of line
* @param y2 y co-ordinate of end of line
public void drawLine(int x1, int y1, int x2, int y2)
graphic.drawLine(x1, y1, x2, y2);
canvas.repaint();
* Sets the foreground color of the Canvas.
* @param newColor the new color for the foreground of the Canvas
public void setForegroundColor(Color newColor)
graphic.setColor(newColor);
* Returns the current color of the foreground.
* @return the color of the foreground of the Canvas
public Color getForegroundColor()
return graphic.getColor();
* Sets the background color of the Canvas.
* @param newColor the new color for the background of the Canvas
public void setBackgroundColor(Color newColor)
backgroundColor = newColor;
graphic.setBackground(newColor);
* Returns the current color of the background
* @return the color of the background of the Canvas
public Color getBackgroundColor()
return backgroundColor;
* changes the current Font used on the Canvas
* @param newFont new font to be used for String output
public void setFont(Font newFont)
graphic.setFont(newFont);
* Returns the current font of the canvas.
* @return the font currently in use
public Font getFont()
return graphic.getFont();
* Sets the size of the canvas.
* @param width new width
* @param height new height
public void setSize(int width, int height)
canvas.setPreferredSize(new Dimension(width, height));
Image oldImage = canvasImage;
canvasImage = canvas.createImage(width, height);
graphic = (Graphics2D)canvasImage.getGraphics();
graphic.drawImage(oldImage, 0, 0, null);
frame.pack();
* Returns the size of the canvas.
* @return The current dimension of the canvas
public Dimension getSize()
return canvas.getSize();
* Waits for a specified number of milliseconds before finishing.
* This provides an easy way to specify a small delay which can be
* used when producing animations.
* @param milliseconds the number
public void wait(int milliseconds)
try
Thread.sleep(milliseconds);
catch (InterruptedException e)
// ignoring exception at the moment
* Nested class CanvasPane - the actual canvas component contained in the
* Canvas frame. This is essentially a JPanel with added capability to
* refresh the image drawn on it.
private class CanvasPane extends JPanel
public void paint(Graphics g)
g.drawImage(canvasImage, 0, 0, null);

Dear Jonathanknight,
Per your suggestion I tried Color.red and Color.green but the error message says "variable COlor not found"
what to do ?
thank you
Stan

Similar Messages

  • Setting/Getting Parameter Values BEFORE and AFTER the param window loads

    Hi there. My name is William Sanchez. I posted this question on Brian Wheadon's blog because I'm not sure that what we're trying to accomplish can be currently done with 2008 Crystal Report Viewer  and was wondering if a future version will support this, or if we're just missing something. I've searched through the SDK and API and can't seem to find a solution. Here's what we're trying to accomplish
    In a nutsheel: we think we need to hook into Crystal Report Viewer's parameter window from our WPF app.
    What we need to do is to be able to pass a set of default values to our parameters AND, after that's done programmatically, still display the parameter window for the report. Currently, however, after you do:
    parameterFieldDefinition.ApplyCurrentValues(currentParameterValues);
    it's as if Crystal says: Ok, we got the value, there's no need to show the parameter window anymore. This makes sense, but we need to still be able to show the parameter window to the user because all we did (from our point of view) is to pass in a default "choice". If we were to call ApplyDefaultValues() instead, the actual choices for the parameter are overriden. We basically want to make a default choice for the user from the allowed values for that parameter. But we want to still present the parameter window with the default choice already selected, plus all the other choices available for that parameter. If the crystal report has parameter1 set to false as default, we might want to programmatically set it to true, but still show false as an option on the parameter window.
    Part 2 of what we'd like to accomplish is that after the user changes any of the parameter values, and clicks OK to view the report, we'd like to catch the new parameter values in code to do something with them.
    This is why we're thinking of hooking into the parameter window so that we can tell it what we want both BEFORE it loads and AFTER the user is done...just like we can hook into the CrystalReportViewer refresh button like this:
    CrystalReportsViewer.ReportRefresh += new CrystalDecisions.Windows.Forms.RefreshEventHandler(CrystalReportsViewer_ReportRefresh);
    Our app is a WPF C# .NET 3.5 desktop application. Any assistance or direction will surely be appreciated.
    Kinds Regards,
    William Sanchez
    Edited by: wsanchez78 on Mar 31, 2010 1:20 AM

    Good day Ted, thanks for your reply.
    I did try Parameter.Default value, but what it does is as I mentioned above. If I have Parameter1 as a boolean, with possible values of true and false, if I set Paramter1.Default = true, the parameter window does come up, but it removed the false option from the drop down. So this is not a way to pick one of the various values for Parameter1, but to default it to only one of the values. It's close to what we need, but not fully.
    Also, what are your thoughts about getting the parameter values after the user has made their changes to the CrystalReportViewer parameter window and click OK to pass them to the report. How can we programmatically get those new values?

  • How to restrict the values for selection in the search help..

    hi,
    i have a requirement regarding screen programming. i have added a i/o field in a screen and i linked a search help for that field.
    i used the standard search help it holds some 15 values for selection...
    when i click on the  search help i m getting some 15 values for selection. but i dont need all the 15 values. i need only 4 values for selection..can any one help me regarding this...
    waiting for ur reply...
    Uday.
    Edited by: uday13 on May 31, 2010 9:17 AM

    Hello,
    Refer the below code and you can provide your own search help to a parameter depending on the value in another parameter:-
    PARAMETERS : p_belnr TYPE belnr,
                 p_bukrs TYPE bukrs.
    DATA : BEGIN OF itab OCCURS 0,
             bukrs TYPE bukrs,
           END OF itab.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_bukrs.
      PERFORM f4_bukrs_help USING p_bukrs.
    *&      Form  f4_bukrs_help
    FORM f4_bukrs_help USING p_bukrs.
      DATA : itab TYPE STANDARD TABLE OF it WITH HEADER LINE,
             tb_dynpfields LIKE dynpread OCCURS 0 WITH HEADER LINE,
             v_belnr TYPE belnr.
      CLEAR:   tb_dynpfields.
      REFRESH: tb_dynpfields.
      MOVE 'P_BELNR' TO tb_dynpfields-fieldname.
      APPEND tb_dynpfields.
      CALL FUNCTION 'DYNP_VALUES_READ'
        EXPORTING
          dyname                               = 'Z_F4' "program name
          dynumb                               = '1000' "screen number
        TABLES
          dynpfields                           = tb_dynpfields
      IF sy-subrc NE 0.
      ENDIF.
    READ TABLE tb_dynpfields INDEX 1.
      IF sy-subrc EQ 0.
        v_belnr = tb_dynpfields-fieldvalue.
      ENDIF.
      SELECT bukrs from <db_table> INTO TABLE itab WHERE belnr = v_belnr.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield               = 'BURKS' "internal table field
          dynpprog               = 'Z_F4' "program name
          dynpnr                 = '1000' "screen number
          dynprofield            = 'P_BUKRS' "screen field name
          value_org              = 'S'
        TABLES
          value_tab              = itab "internal table
      IF sy-subrc NE 0.
      ENDIF.
    ENDFORM.                    " f4_bukrs_help
    Hope this helps you.
    Regards,
    Tarun

  • Will not include all my topics in the compiled help file

    I've been rebuilding my project, because it seems like my
    file were too big and so the project was no longer compiling
    successfully.
    Now I have spilt some of the contents of the larger word
    file, into two smaller word files and included the topics from
    these into the TOC and bascially rebuilt most of the project.
    However, now, the compiled version of the file only includes the
    topics and books from the first smaller file and ignores that
    contents in the second file.
    How do I solve this? I have selected to include both these
    files into the compiled file, but it still does not work.

    I've been rebuilding my project, because it seems like my
    file were too big and so the project was no longer compiling
    successfully.
    Now I have spilt some of the contents of the larger word
    file, into two smaller word files and included the topics from
    these into the TOC and bascially rebuilt most of the project.
    However, now, the compiled version of the file only includes the
    topics and books from the first smaller file and ignores that
    contents in the second file.
    How do I solve this? I have selected to include both these
    files into the compiled file, but it still does not work.

  • Unable to get parameter values from a remote database

    I am linking to a remote database view via a synonym in Oracle and trying to retrieve parameter values from it.  The username and password are the same for the local and remote database and I can run the SQL query using SQL plus against the database and values are returned.  However, when I try and run the same query in Crystal Reports (XI) I receive an Oracle error:
    "An attempt was made to connect or log in to a remote database using a connection description that could not be found.
    Action: 
    Specify an existing database link. Query the data dictionary to see all existing database links. See your operating system-specific Net8 documentation for valid connection descriptors. "
    How can it be that Crystal cannot run the query when it is valid in SQL plus?
    Any tips/info would be appreciated.
    many thanks
    Claire
    Oracle is version 10

    When running one of the reports in VS.Net this is the error I receive:
    "A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in crystaldecisions.crystalreports.engine.dll
    Additional information: Failed to retrieve data from the database.
    Details:  [Database Vendor Code: 2019 ]
    Failed to retrieve data from the database.
    Error in File C:\DOCUME1\CLAIRE1.REE\LOCALS~1\Temp\{0C6C6DD5-B958-4E10-A2AA-928C58E1B7CE}.rpt:
    Failed to retrieve data from the database.
    Details:  [Database Vendor Code: 2019 ]"
    When running the same report in Crystal Reports designer I receive this error message:
    "Prompting failed with the following error message: 'List of Values failure: fail to get values. [Cause of error: Failed to retrieve data from the database.  Details: [Database Vendor Code: 2019].  Failure to retrieve data from the database.  Error in File UNKNOWN.RPT.  Failure to retrieve data from the database.  Details: [Database Vendor Code: 2019]]'.
    Error source: prompt.dll Error code: 0x8004380D"
    So this one is also failing in the designer.
    All the parameters in the main report are static and the ones in the subreport are passed in from the main report.

  • Crystal Report Viewer 11.5 Java SDK - How to set sub report parameter value

    Good day!
    I have a report with 3 sub-reports in the detail section. Main report has two parameters and each sub-report has one parameter in turn. We have our own JSP to receive parameter values from the user. I am using the following code to do the parameter value setting later into the report. Parameter value setting works for main report, but not for the sub-report.
    I get an Error, for the first sub-report, from the viewer saying:
    The parameter 'parametername' does not allow null values
    On this article: [article link|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bi/sap%28bd1lbizjptawmq==%29/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233313337333233323331%7D.do]
    It says to set the report name of the parameter field to the name of the sub report. On this aspect, assuming this tip/solution works, I would like to read the names of the sub-reports and their parameter names. I do not want to hard-code them into our application.
    Here is my current code:
    sdk.occa.report.data.Fields parameterFields = new Fields();
    I have a HashMap of <parameterName, parameterValue>
    Iterate through the map
    report.data.ParameterField aParameterField = new ParameterField();
    aParameterField.setReportName(""); //main report
    report.data.Values theValues = new Values();
    ParameterFieldDiscreteValue aParameterFieldDiscreteValue = new ParameterFieldDiscreteValue();
    aParameterFieldDiscreteValue.setValue (aValue);
    theValues.add(aParameterFieldDiscreteValue);
    aParameterField.setName(parameterName)
    aParameterField.setCurrentValues(theValues);
    parameterFields.add(aParameterField);
    viewer.setParameterFields(parameterFields);
    Please look at the line:
    aParameterField.setReportName(""); //main report
    Here's where I would like to say
    if (parameter is subreport's parameter) then setReportName(subreport name);
    Thx

    It was little difficult to navigate down the objects to find the sub reports and their parameters. I am attaching the code:
    May be there are other ways to do the same.
    public String getReportNameForParameter (String parameterName, ReportClientDocument reportClientDoc)
            String result = "";
            boolean found = false;
            try {
                SubreportController src = reportClientDoc.getSubreportController();
                DataDefController ddc = reportClientDoc.getDataDefController();
                IDataDefinition idd = ddc.getDataDefinition();
                Fields fs = idd.getParameterFields();
                Iterator fiter = fs.iterator();
                while (fiter.hasNext()) {
                    IField ifld = (IField) fiter.next();
                    if (parameterName.equals(ifld.getName())) {
                        found = true;
                    //System.out.println ("\t Field Name/Description/HeadingText: " + ifld.getName() + "/" + ifld.getDescription() + "/" + ifld.getHeadingText());
                if (!found) {
                    IStrings reportNames = src.getSubreportNames();
                    //System.out.println ("  Sub Reports If Any ...");
                    if (reportNames != null) {
                        Iterator iter = reportNames.iterator();
                        while (iter.hasNext()) {
                            String repName = (String) iter.next();
                            //System.out.println ("\t Sub Report Name " + repName);
                            ISubreportClientDocument srcd = src.getSubreport(repName);
                            ddc = srcd.getDataDefController();
                            idd = ddc.getDataDefinition();
                            fs = idd.getParameterFields();
                            fiter = fs.iterator();
                            while (fiter.hasNext()) {
                                IField ifld = (IField) fiter.next();
                                if (parameterName.equals(ifld.getName())) {
                                    result = repName;
                                    break;
                                //System.out.println ("\t\t Field Name/Description/HeadingText: " + ifld.getName() + "/" + ifld.getDescription() + "/" + ifld.getHeadingText());
            //System.out.println ("********************************************************** ");
            catch (Exception exc) {
                System.out.println ("Error/Exception while trying to find the report name for parameter [" + parameterName + "]");
                System.out.println ("*******************************************************************************************");
                exc.printStackTrace();
            return result;

  • Passing parameter values to powershell function from batch file

    Hello ,
       I haven't used powershell for a while and getting back to using it. I have a function and I want to figure out how to pass the parameter values to the function through batch file.
    function Check-FileExists($datafile)
    write-host "InputFileName : $datafile"
    $datafileExists = Test-Path $datafile
    if ($datafileExists)
    return 0
    else
    return -100
    <#
    $datafile = "C:\Dev\eMetric\PreIDWork\PreIDFiles\SampleInputFile_011.txt"
    $returncode = Check-FileExists -datafile $datafile
    Write-Host "ReturnCode : $returncode"
    $datafile = "C:\Dev\eMetric\PreIDWork\PreIDFiles\SampleInputFile_01.txt"
    $returncode = Check-FileExists -datafile $datafile
    Write-Host "ReturnCode : $returncode"
    #>
    The above code seems to be work when I call it. But when I try to call that script and try to pass the parameter values, I am doing something wrong but can't figure out what.
    powershell.exe -command " &{"C:\Dev\eMetric\PreIDWork\PowerShell\BulkLoad_Functions.ps1" $returncode = Check-FileExists -datafile "C:\Dev\eMetric\PreIDWork\PreIDFiles\SampleInputFile_01.txt"}"
    Write-Host "ReturnCode : $returncode"
    $file = "C:\Dev\eMetric\PreIDWork\PreIDFiles\SampleInputFile_01.txt"
    powershell.exe -file "C:\Dev\eMetric\PreIDWork\PowerShell\BulkLoad_Functions.ps1" $returncode = Check-FileExists -datafile $datafile
    Somehow the I can't get the datafile parameter value being passed to the function. Your help would be much appreciated.
    I90Runner

    I am not sure about calling a function in a script like how you want to. Also I see you are setting the values of the parameters, this is not needed unless you want default values if nothing is passed. The values for the parameters will be passed via the
    batch file. So for me the easiest way is as indicated.
    param
    [string]$DataFile
    function Check-FileExists($datafile)
    write-host "InputFileName : $datafile"
    $datafileExists = Test-Path $datafile
    if ($datafileExists)
    return 0
    else
    return -100
    Write-Host "Return Code: $(Check-FileExists $DataFile)"
    Then you create a batch file that has
    start powershell.exe
    -ExecutionPolicy
    RemoteSigned -Command
    "& {<PathToScript>\MyScript.ps1 -DataFile 'C:\Dev\eMetric\PreIDWork\PreIDFiles\SampleInputFile.txt'}"
    Double click the batch file, and it should open a powershell console, load your script and pass it the path specified, which then the script runs it and gives you your output
    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.
    Don't Retire Technet

  • Invalid parameter value Error while Extending PoReqDistributionsVO

    Hi,
    My Requirement is to restrict user from enetring certain values in a field in iProcurement Page based on some condition. The attribute on which I have to place the validation is CodeCombinationId and the VO name is PoReqDistributionsVO. So, I extended the VO and generated the VORowImpl class for the extended VO. Please note that I have extended the VO just to override the setter method for the CodeCombinationId in the VORowImpl. I did not change any other thing on the VO. Once I deploy the code, I am getting the following error for the first time:
    ## Detail 0 ##
    oracle.jbo.InvalidParamException: JBO-25006: Invalid parameter value PoReqDistributionsVO for source passed to method ViewLinkImpl.setSource. Explanation: view def mismatch
    And then if I try to open the page again, it gives me multiple distribution lines. (Say for example I have only one distribution line for the requistion line and my distribution table PO_REQ_DISTRIBUTIONS_ALL has total 20 records, then all the 20 records are getting displayed in the front end.)
    So, clearly after I extended the VO, the viewlink is not able to identify the viewlink.
    I went through the following thread:
    oracle.jbo.InvalidParamException: JBO-25006: Invalid parameter value
    As suggested in the therad, I thought of copying all the view link related methods from the original VO files. But, I could not get any Viewlink related information in any of the three seeded files PoReqDistributionsVO.xml, PoReqDistributionsVOImpl.class and PoReqDistributionsVORowImpl.class. But I can find one View Link oracle.apps.icx.por.req.server.ReqLineToDistributionsVL in teh server which is linking PoRequisitionLinesVO to PoReqDistributionsVO.
    Could anyone suggest me what I need to do to resolve the issue.
    Edited by: 892480 on Oct 20, 2011 8:13 AM

    Hi Gurus,
    Any suggestion on the above issue?

  • "Missing parameter values." Error when setting record selection formula

    Setup - VS 2008, CR 2008 (v12.0), Win XP & C#.Net
    I have a form which loops through all parameters (non-linked to sub reports, so only off the main report) and allows users to enter the values for each parameter. When hitting the preview button, I loop through all of the saved values, set the parameter field values and then add any additional filters into the recordselection formula as below. The problem i'm having is that the ReportDocument.HasRecords returns true if the ReportDocument.RecordSelectionFormula doesn't filter out every result.
    For example, I have a list of customers and if I set the selection formula to filter out a specific customer, ReportDocument.HasRecors returns true, if I set the selection formula to filter something that doesn't exist i.e. customer "xk39df", the moment this line of code runs "ReportDocument.RecordSelectionFormula = rsFormula;" - ReportDocument.HasRecors returns the following exception as opposed to "False".
    Message: Missing parameter values.
    Source: CrystalDecisions.ReportAppServer.DataSetConversion
    StackTrace:    at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.hasRecords()
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.get_HasRecords()
    ErrorID: MissingParameterFieldCurrentValue
    The strange thing is, it works fine if the recordselectionformula selects a record which exists in the results - all parameters have a current value except for the linked parameters.
    This one has got me stumped!
    foreach (ParameterFieldDefinition parameterField in ReportDocument.DataDefinition.ParameterFields)
                    var query = ReportObjects.Values.Cast<Filters>().Where(objects => objects.ParameterName == parameterField.Name.ToUpper().Trim());
                    foreach (var item in query)
                        parameterField.CurrentValues.Clear();
                        parameterField.CurrentValues.Add(item.ParameterValue);
                        parameterField.ApplyMinMaxValues(item.MinLength, item.MaxLengh);
                        parameterField.ApplyCurrentValues(parameterField.CurrentValues);
                var records = ReportObjects.Values.Cast<Filters>().Where(recordSelection => recordSelection.RecordSelectionFormula.Trim().Length != 0);
                foreach (var item in records)
                    rsFormula += item.RecordSelectionFormula;
                if (rsFormula.EndsWith(" AND "))
                    rsFormula = rsFormula.RTrim(5);
                ReportDocument.RecordSelectionFormula = rsFormula;

    Hi,
    The report has it's own ADO Datasource set in crystal reports, so I just pass the log on information to the report object before doing anything else.
    this.DataSourceConnections[0].SetConnection("ServerName", "Database", "sa", "Password");
    I then do a refresh before applying the parameter values (I do this because the user can preview the report more than one time by using a preview button on the parameter form without re-loading the report object)
    this.Refresh();
    Then I set all parameter values followed by setting the recordselection formula.

  • Missing parameter values message when exporting report

    Post Author: Gr_Pr
    CA Forum: .NET
    Using .NET 2005, CR XI R2, and the Crystal SDK for .NET 2005 to generate reports. Basically CR is my application's reporting tool. So, we create a report in CR XI R2, then distribute that report to our users loading it into the .NET application using the Report Document class.
    We have a small problem.
    Our user's have the ability to use pre-defined 'prompts' that will pass parameters to the reports. Let's say that the prompt will pass in (5) pre-defined parameter values, but the customer wants to run their own 'custom' report using our prompt, but their 'custom' report contains (6) parameters.
    If I let the Report Viewer load the report, the user will be prompted for the missing parameter value that was not supplied by the 'prompt'.
    If I run the report without loading it into the Viewer and try to export the report directly to PDF I receive an error message from CR stating I have 'Missing Parameter Values' then the report errors out.
    Has anyone come across this? Is there something I missed?
    I am not real sure as to why you would be prompted by the Viewer and not by the Export Class. This worked fine when using the RDC component, I was prompted for the missing parameter value by both options.
    Any help would be greatly appreciated.

    Hi,
    The report has it's own ADO Datasource set in crystal reports, so I just pass the log on information to the report object before doing anything else.
    this.DataSourceConnections[0].SetConnection("ServerName", "Database", "sa", "Password");
    I then do a refresh before applying the parameter values (I do this because the user can preview the report more than one time by using a preview button on the parameter form without re-loading the report object)
    this.Refresh();
    Then I set all parameter values followed by setting the recordselection formula.

  • URL Reporting Time parameter value.

    We have installed Business objects XIR2 and one of our application uses URL reporting to call a crystal report. Parameter values are retrieved from the database and used in the url.  Reports that do not have a time parameter works fine.  Even though I pass the time parameter value Im still prompted for the value.  The format of the url I use is http://hostname/businessobjects/viewrpt.cwr?init=dhtml&apstoken=<token>&prompt0=02:02:20&prompt1=LOCCODE
    where prompt0 is of type par_time.  Could someone please help me with the correct format to use for parameter type time?

    Ted, I checked the prompt order and the prompt type and they are correct.  These reports are working fine on Crystal 9.  Also reports that do not have a time parameter works fine in Crystal 11. Its only when reports with time parameter are called Im prompted for a value to be entered in hh:mm:ss format although I tried passing the value in hh:mm:ss format and Time(hh, mm, ss) format in the url.  The report comes up fine after entering the value in hh:mm:ss value in the prompt.  I tried encoding the url but it didnt work.  If I encode the entire url Crystal prompts me to enter values for all parameters.

  • Bookmark transaction with parameter values

    Hello,
    i want to add a bookmark to the sapgui (6.4) usermenu which starts a transaction (rsdmd) and also passes the parameter-value (infoObject), so that the user don't has to search for the respective infoObject.
    Is that possible with sapgui?

    Hi
    You can call a transaction passing it values for the screen:
    Addition 2
    ... USING bdc_tab [bdc_options]
    Effect
    Use this addition to pass an internal table bdc_tab of row type BDCDATA from the ABAP Dictionary to a dialog transaction. The additions bdc_options control the batch input processing. When a transaction with addition USING is called, the system field sy-binpt is set to value "X" in the called program - while this transaction is running, no other transaction can be called with this addition.
    OR
    You could call the program that the transaction calls directly using the submit statement as follows:
    SUBMIT {rep|(name)} [selscreen_options]
                        [ list_options ]
                        [ job_options]
                        [AND RETURN].
    Your full requirement however is unclear as you do not specify whether you are working with SAP Standard programs or custom programs etc. I think you should elaborate on your requirement.
    Regards

  • How to get values/data stored in the database into a list-item.

    how to get values/data stored in the database into a list-item.
    i tried to make a list item without any values assigned to it...but i got the below error.
    FRM-30191: No list items defined for required poplist.
    or
    FRM-32082: Invalid value for given item type.
    List EMPNO
    Item: EMPNO
    Block: EMP
    Form: MODULE5
    FRM-30085: Unable to adjust form for output.
    then according to some docs, i tried the the following for the trigger
    when-new-form-instance
    declare
         rg_name varchar2(40) := 'emp_rec';
         status number;
         groupid recordgroup;
         it_id item;
    begin
         it_id := Find_Item('empno');
         groupid := create_group_from_query(rg_name, 'select empno from emp');
         status := populate_group(groupid);
         populate_list(it_id, groupid);
    end;
    but yet didnt work... :(
    so how the heck do i get values fetched from the database table into the list item?

    for list items you need to values in the record group, one is the shown value and one is the returned value.
    Check out the online help for the populate_list built-in.
    You'll need something like select ename,ename from emp as the record group query.

  • Value assignment and value assignment type in the specification workbench

    Hi all,
    There is this section on the specification workbench called u201CProperty Treeu201D, this section contains all the value assignment type, I have two questions on this.
    Question 1 u2013
    What is exactly the value assignment type? The SAP help portal said it is a structure specification data and information. What exactly does it mean and its usage?
    Question 2 u2013
    May I know where is the SPRO configuration that actually causes the list of value assignment types appear on the property tree section for this particular specification type which I created.
    In another word, I create this new specification with specification type u201CREAL_SUBu201C and specification category u201CSubstanceu201C in the specification workbench transaction. Next thing I know is that the property tree section for this particular specification consists of a list of value assignment type. How does the system assigned these list of value assignment types to this specification i created? Coz I didnu2019t do anything.
    Where in SPRO and the logic link it up on this??
    Thanks.
    YY

    Hello all
    EH&S contains a number of submodules (PS, DG, IH etc.). Regarding each submodule a basic customizing is delivered by SAP. One example is the specification type. Usually you will find something like
    REAL_SUB
    LIST_SUB
    etc. in the Customizing as discussed. Further more I believe with EH&S 2.7. the specification category come in place (SUBSTANCE as an example). You need to take care regarding this too.
    An value assignment type can be grouped in a property tree and a property tree can be linked to a specification type and there are cases known that one specification type is linked only to one property tree (this is a decision regarding business needs and not an IT quesition). Using the EHS& surface you can change the property tree per specification if the set up is done in Customizing. Therefore the property tree is a "view" on the data linked to a specification. (identifeirs etc. are managed different)
    A "property" is based on a value assigment type and in many cases on a related EH&S class and characteristic. You will find these types.
    A => value assignment type to be used if you need characteristics
    B => value assignment type to be used if you need specification listing
    C  => value assignment type to be used if you need composition
    .. etc.
    You can mix types. That means you can create a property of type "A" and "C" (take a look in SAP original tree; you will find examples how to do it).
    A propetry tree is a "list" of assignment type related to a object (specification). Using the property tree you can maintain necessary data. Therefore ithe property tree itself contains per specification the list of "potential" data structures you can fill with data. I belive SAP Standard is delviering now something like 250 properties (valeu assignment types): To e.g. get an MSDS you need to maintain I would assume at least something like 20 up to 50 properties
    The area of customizing regrading property tree, specification types etc.  is the most crticial to have a sucessful EH&S project running; any wrong decision gives rise to a high cost later Therefore take your time to understand what effect does which customizing acitivity have later.
    Based on the value assignemnt you will create later e.g. a WWI report (like MSDS).
    Additionally if necessary you can create customer specific value assignment types by either do a copy from SAP original to "Z" (highly recommended to do so!) or starting from basic. 
    Starting with EH&S 2.7. you have now more options to "change" EH&S using standard EH&S functionality. Take a look in customizinjg (example: you could create you own "look and feel" of the workbench (you should'nt really do that but it is possible). You can design your own "tab strips" etc.
    So once again: the "correct" set up of EH&S in the area of e.g. identifers, speficiation types, property trees etc. is the "core" activity in EH&S customizing and therefore think "twice" before you change the setup up (you need to understand what a change mean)
    With best regards
    C.B.

  • Hiding topics in compiled help

    Is there a way to hide a topic so that it is included in the
    compiled help but can only be found by searching with a specific
    keyword? I don't want to exclude it from the compiled help; I just
    don't want it to be visible to the general public but still
    accessible to those of us who need it.

    Any topic that is not indexed, not in the TOC and not linked
    from other topics etc can only be accessed by searching. However
    the search will catch all text rather than just a keyword.
    There are threads here describing how to exclude topics from
    a search. How about excluding the topic from a search but making
    the topic accessible by some hidden means in another topic. For
    example, create a small icon the same colour as the background of a
    page so that it cannot be seen. Make that a hyperlink to the topic.
    I accept it is a kludge but it is only for a small number of people
    in the know as to where that graphic is, it would work.

Maybe you are looking for

  • Ipod not showing up in itunes windows 8

    after updating my iphone 3gs, which i now use an ipod, when i plug it up to my computer and open itunes, itunes does not recognize my device. help

  • How to get rid of "brought by FlashMall" add ?

    Suddenly whenever change web page, new tab show with some adds when click on original pad annoying adds show on top and bottom page..how to stop it?

  • Loss of space after reorg of compressed index

    Hi Oracle experts, In 2008 we compressed indexes of ECC system as per sap note 1109743 and obtained high compression ratio. Now we have upgraded to oracle 11.2.0.2 and BRTOOLS 7.20 (10). While using brtools to do table reorg/compression as per note 1

  • Material analyses report.

    Hi gurus, what are all involved in a  and what is a material analyses report <b>Material Price Analysis Report</b> could u plz explain. regards, siri. Message was edited by: sireesha yalamanchili

  • What is a good ID5 Document Setup for an epub ebook for the iPhone?

    I'd welcome some help using ID5 to create an ebook that is optimized for displaying on the iPhone. In particular, I'm looking for appropriate dimensions of the base page, in pixels, to enter in the Document Setup dialog box. From what I've read, 320