Using Calendar.set() method problem

Hi all,
First of all sorry to bother with such a trivial(?) matter but I cannot solve it by myself.
I have a piece of code which I simply want to handle the current date with the GregorianCalendar object so that the date would be set to the Calendar.SUNDAY (of the current week). Simple enough?
Code as follows:
import java.util.*;
import java.text.*;
public class Foo
public static void main(String[] args)
     Foo foo = new Foo();
     Date newdate = foo.bar();
public Date bar()
     GregorianCalendar m_calendar = new GregorianCalendar(new Locale("fi","FI"));
     m_calendar.setFirstDayOfWeek(Calendar.MONDAY);
     Date newDate = null;
     try
          m_calendar.setTime(new Date());
          System.out.println("Calendar='" + m_calendar.toString() + "'");
          m_calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
          SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
          StringBuffer sb = new StringBuffer();
          sdf.format(m_calendar.getTime(), sb, new FieldPosition(0));
          System.out.println("Date in format (" + sdf.toPattern()          + ") = '" + sb.toString() + "'");
     catch(Exception e)
          e.printStackTrace();
     return m_calendar.getTime();
This should work at least accoring to my understanding of the SDK documentation as follows with
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
Calendar='java.util.GregorianCalendar[time=1054636838494,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Helsinki",offset=7200000,dstSavings=3600000,useDaylight=true,transitions=118,lastRule=java.util.SimpleTimeZone[id=Europe/Helsinki,offset=7200000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2003,MONTH=5,WEEK_OF_YEAR=23,WEEK_OF_MONTH=1,DAY_OF_MONTH=3,DAY_OF_YEAR=154,DAY_OF_WEEK=3,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=1,HOUR_OF_DAY=13,MINUTE=40,SECOND=38,MILLISECOND=494,ZONE_OFFSET=7200000,DST_OFFSET=3600000]'
Date in format (yyyy.MM.dd) = '2003.06.08'
Which is the sunday of this week. But as I run the same code with:
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1.06-020625-14:20)
Java HotSpot(TM) Server VM (build 1.3.1 1.3.1.06-JPSE_1.3.1.06_20020625 PA2.0, mixed mode)
Calendar='java.util.GregorianCalendar[time=1054636630703,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=java.util.SimpleTimeZone[id=Europe/Helsinki,offset=7200000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2003,MONTH=5,WEEK_OF_YEAR=23,WEEK_OF_MONTH=1,DAY_OF_MONTH=3,DAY_OF_YEAR=154,DAY_OF_WEEK=3,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=1,HOUR_OF_DAY=13,MINUTE=37,SECOND=10,MILLISECOND=703,ZONE_OFFSET=7200000,DST_OFFSET=3600000]'
Date in format (yyyy.MM.dd) = '2003.06.01'
Which is sunday of the previous week and incorrect in my opinion. The latter result is run on HP-UX B.11.11 U 9000/800 and first on NT.
Any ideas why this is happening? Thanks in advance!
Greets, Janne

Thanks for your answer!
The problem is that I have to work with this older SDK version. :) But I got it solved by using the roll method with the following syntax:
int delta = [dayToSet] - m_calendar.get(Calendar.DAY_OF_WEEK);
in which the delta is of course the difference (negative or positive to the current day of the week)
and then using the roll call:
m_calendar.roll(Calendar.DAY_OF_WEEK, delta);
which doesn't alter the current week. So this works if someone else has a similar problem with the version 1.3.1
Greets, Janne

Similar Messages

  • Change the properties of a field dynamically using Getter/Setter methods

    Thanks
    Raj
    Edited by: RajICWeb on Aug 12, 2009 4:31 AM

    Hi Harshit
    Thanks for the reply. Like you suggested, I redefined the get_i_zfield( ) method. But the program is not going through this method.
    FYI.....I created the getter/setter methods manually for my zfield. Plz let me know if I am missing anything. Your help will be greatly appreciated.
    Below is my requirement:
    I need to add an additional column (zfield) to a tree view. The name of the component is BTRESTREE. (there is only one view in this component- this view is having only one context node).
    I tried adding my zfield to the attributes (of the context node) through the wizard by right clicking on the 'Attributes'. But I am not getting the 'Create' Option.
    I posted a thread few days back regarding the same problem. One of the experts (Vikash Krishna) suggested me to add some my zfield by redefining the 'GET_TABLE_LINE_SAMPLE' method. As per his suggestion, I was finally able to see my zfield in
    the configuation tab.
    Now, I have to change the properties of my zfield (make this column editable) in the tree view. For that, the only option that I can see is to change the get_i_zfield( ) method (here we have 'rv_disabled') for my zfield. For this, first I need to add my zfield to the Attributes. To achieve this, I added getter/setter methods manually in the Proxy class.
    Thanks
    Raj

  • Pass as a parameter or use set() method?

    This question may be a bit too abstract:
    A method of ClassB needs the HashMap member variable 'map' from ClassA. Should I pass map as a parameter into a method of ClassB, i.e.
    ClassB b = new ClassB();
    b.aMethod(map);or should I use a set() method in ClassB to set a member variable of type HashMap in ClassB, i.e.
    ClassB b = new ClassB();
    b.setMap(map); //sets the HashMap member variable in ClassB to equal map
    b.aMethod(); //aMethod now performs its operation on the HashMap member variable of ClassBHow do you decide which way is prefereable?

    Depends on your model, I suppose. Form the example, though, I wouldn't make the map a member of Class B, unless Class B should logically possess such a map. If the method in Class B is just operating on some values from the map, it makes more sense to me just to pass it in as an argument.

  • Using getter/setter for returing a string variable to display on an Applet

    have two classes called, class A and class testA.
    class A contains an instance variable called title and one getter & setter method. class A as follow.
    public class A extends Applet implements Runnable, KeyListener
         //Use setter and getter of the instance variable
         private String title;
         public void init()
              ASpriteFactory spriteFactory = ASpriteFactory.getSingleton();
              // Find the size of the screen .
              Dimension theDimension = getSize();
              width = theDimension.width;
              height = theDimension.height;
              //Create new ship
              ship = spriteFactory.createNewShip();
              fwdThruster = spriteFactory.createForwardThruster();
              revThruster = spriteFactory.createReverseThruster();
              ufo = spriteFactory.createUfo();
              missile = spriteFactory.createMissile();
              generateStars();
              generatePhotons();
              generateAsteroids();
              generateExplosions();
              initializeFonts();
              initializeGameData();
              //Example from Instructor
              //setMyControlPanel( new MyControlPanel(this) );
              // new for JDK 1.2.2
              addKeyListener(this);
              requestFocus();
         public void update(Graphics theGraphics)
              // Create the offscreen graphics context, if no good one exists.
              if (offGraphics == null || width != offDimension.width || height != offDimension.height)
                   // This better be the same as when the game was started
                   offDimension = getSize();
                   offImage = createImage(offDimension.width, offDimension.height);
                   offGraphics = offImage.getGraphics();
                   offGraphics.setFont(font);
              displayStars();
              displayPhotons();
              displayMissile();
              displayAsteroids();
              displayUfo();
              //displayShip();
              //Load the game with different color of the space ship          
              displayNewShip();
              displayExplosions();
              displayStatus();
              displayInfoScreen();
              // Copy the off screen buffer to the screen.
              theGraphics.drawImage(offImage, 0, 0, this);
         private void displayInfoScreen()
              String message;
              if (!playing)
                   offGraphics.setColor(Color.white);
                   offGraphics.drawString("\'A\' to Change Font Attribute", 25, 35);
                   offGraphics.drawString(getTitle(), (width - fontMetrics.stringWidth(message)) / 2, height / 2
                             - fontHeight);
                   message = "The Training Mission";
                   offGraphics.drawString(message, (width - fontMetrics.stringWidth(message)) / 2, height / 2);
                   message = "Name of Author";
                   offGraphics.drawString(message, (width - fontMetrics.stringWidth(message)) / 2, height / 2
                             + fontHeight);
                   message = "Original Copyright 1998-1999 by Mike Hall";
                   offGraphics.drawString(message, (width - fontMetrics.stringWidth(message)) / 2, height / 2
                             + (fontHeight * 2));
                   if (!loaded)
                        message = "Loading sounds...";
                        int barWidth = 4 * fontWidth + fontMetrics.stringWidth(message);
                        int barHeight = fontHeight;
                        int startX = (width - barWidth) / 2;
                        int startY = 3 * height / 4 - fontMetrics.getMaxAscent();
                        offGraphics.setColor(Color.black);
                        offGraphics.fillRect(startX, startY, barWidth, barHeight);
                        offGraphics.setColor(Color.gray);
                        if (clipTotal > 0)
                             offGraphics.fillRect(startX, startY, (barWidth * clipsLoaded / clipTotal), barHeight);
                        offGraphics.setColor(Color.white);
                        offGraphics.drawRect(startX, startY, barWidth, barHeight);
                        offGraphics
                                  .drawString(message, startX + 2 * fontWidth, startY + fontMetrics.getMaxAscent());
                   else
                        message = "Game Over";
                        offGraphics.drawString(message, (width - fontMetrics.stringWidth(message)) / 2, height / 4);
                        message = "'S' to Start";
                        offGraphics.drawString(message, (width - fontMetrics.stringWidth(message)) / 2, height / 4
                                  + fontHeight);
              else if (paused)
                   offGraphics.setColor(Color.white);
                   message = "Game Paused";
                   offGraphics.drawString(message, (width - fontMetrics.stringWidth(message)) / 2, height / 4);
         public String getTitle() {
              System.out.print(title);
              return title;
         public void setTitle(String title) {
              this.title = title;
    }displayInfoScreen method in class A calls out for getTitle( ) to be displayed on an applet as an initial display string for the application.
    The instance variable title is set by setTitle method which is called out in class testA as follow,
    public class testA extends TestCase
          * testASprite constructor comment.
          * @param name
          *          java.lang.String
         public testA(String name)
              super(name);
          * Insert the method's description here.
          * @param args
          *          java.lang.String[]
         public static void main(String[] args)
              junit.textui.TestRunner.run(suite());
              // need to figure out how to get rid of the frame in this test
              System.exit(0);
         public static Test suite()
              return new TestSuite(testA.class);
          * Basic create and simple checks
         public void testCreate()
              A theGame = new A();
              assertNotNull("game was null!", theGame);
          * Basic create and simple checks
         public void testInit()
              A theGame = new A();
              Frame gameFrame = new Frame("THE GAME");
              gameFrame.add(theGame);
              int width = 640;
              int height = 480;
              gameFrame.setSize(width, height);
              // must pack to get graphics peer
              gameFrame.pack();
              theGame.resize(width, height);
              theGame.setTitle("TEST THE GAME");
              theGame.init();
              assertEquals("ASprite width not set", A.width, width);
              gameFrame.dispose();
              gameFrame.remove(theGame);
    }Basically, class testA invokes the init( ) method in class A and start the applet application. However, it displays a white blank display. If I change the getTitle( ) in the displayInfoScreen method to a fixed string, it works fine. Did I forget anything as far as using getter & setter method? Do I have to specify some type of handle to sync between setter and getter between two classes? Any feedback will be greatly appreciated.
    Thanks.

    Your class A extends runnable which leads me to believe that this is a multi-threaded application. In that case, title may or may not be a shared variable. Who knows? It's impossible to tell from what you posted.
    Anyway, what is happening is that your applet is being painted by the JFrame before setTitle is called. After that, who knows what's happening. It's a complicated application. I suspect that if you called setTitle before you added the applet to the frame, it would work.

  • Initialize in the constructor is better or set the value thro' set method?

    Hi,
    For the normal helper classes for servelt or jsp or EJB,
    Which of the following one is the better ...?
    1.
    i.initialize all the fields in the constructor, then
    ii.use the set methods
    or
    2.
    i.do not use the contructor and
    ii.use the set methods to set the values
    Anybody can give the solution for this one...
    With regards
    vkm

    Your option 1 puzzles me, why would you need tyo use the setter methods if you already initialized in the constructor?

  • Calendar.getInstance method not loading userdefined locale classes

    Hi
    In JDK 6
    I have implemented CalendarData_en_AT class for locale(en, AT) which is a user defined locale(not defined in jre). I see that when I try to load the locale using Calendar.getInstance method it loads CalendarData_en.class
    When further debugged, I found that it picks up only the locales that are specified in LocaleMetaDataInfo class
    What needs to be done so that when we call Calendar.getInstance(new Locale(en, AT)) it loads CalendarData_en_AT.class
    Thanks
    -Beena

    I have a class CalendarData_en_AT.java
    public class CalendarData_en_AT extends LocaleNamesBundle
    public CalendarData_en_AT()
    protected final Object[][] getContents()
    return (new Object[][] {
    new Object[] {
    "firstDayOfWeek", "2"
    }, new Object[] {
    "minimalDaysInFirstWeek", "4"
    The compiled class is enclosed in a .jar file and have been placed in jre/lib/ext
    Now from my test class
    if I call Calendar.getInstance(new Locale("en","AT")).getFirstDayOfWeek()
    it should return 2, but as of now it returns 1, reason being it loads CalendarData_en.class and not CalendarData_en_AT.class which is user implemented

  • Use VB Set keyword with Clone method?

    I am using the TestStand API with Visual Basic 6.0 SP5. Is is necessary to use the Set keyword when calling the Clone method of a PropertyObject? i.e. which is correct:
    Set thePropObj = existingPropObj.Clone("", 0)
    or
    thePropObj = existingPropObj.Clone("", 0)
    Seems the Set keyword would be required, but I am
    running into funny problems with this. I have a step
    that I am trying to create a copy of. (The step contains a call to a LabVIEW VI.) If I omit the Set keyword, execution hangs at the call to Clone. If I include the Set keyword, all information present in the original PropertyObject doesn't seem to get copied to the new one. (Also, oddly enough, if I omit the set keyword, and the step calls a CVI function, everything seems to work
    fine!)
    Anyone have any advice?
    Thanks in advance
    D. LaFosse

    Hello LaFosse,
    You need to use the Set keyword before the clone method statement. However, I have a couple of comments about the code you sent.
    This is the code you sent:
    ' Start up the testStand engine
    Dim theTS As TS.Engine
    Set theTS = New TS.Engine
    ' OK, load in the sequence file I
    ' created. This sequence file
    ' contains nothing more than a call
    ' to a VI in the main stepgroup of
    ' the MainSequence.
    Dim seqFile As SequenceFile
    Set seqFile =
    theTS.GetSequenceFile()
    ' get a handle to the MainSequence
    Dim seq As Sequence
    Set seq = seqFile.GetSequenceByName
    ("MainSequence")
    ' Get a handle to the step that calls
    ' the VI, and a property object for
    ' the step
    Dim theStep As Step
    Set theStep =
    seq.GetStep(0, StepGroup_Main)
    Dim theStepProp As PropertyObject
    Set theStepProp =
    theStep.AsPropertyObject
    ' Create another step. We will attempt
    ' to use Clone to fill in the
    ' properties of this step.
    Dim theOtherStep As Step
    Dim theOtherStepProp As PropertyObject
    Set theOtherStep = theTS.NewStep("",
    TS.StepType_Action)
    Set theOtherStepProp =
    theOtherStep.AsPropertyObject
    ' Call clone...this step will hang.
    theOtherStepProp =
    theStepProp.Clone("", 0)
    Basically the problem is that you are not loading the TypePallete after creating the engine. You shoud include right after the Set theTS = New TS.Engine:
    theTS.LoadTypePaletteFiles
    This should avoid the crash.
    Some Additional comments:
    1. With VB you don't need to create property objects from other objects. All the classes, except the Engine Class, inherit from the Property Object Class. The following Code does the same thing, but without creating propertyobjects directly:
    Sub MySub()
    'Variable Declaration
    Dim theTS As TS.Engine
    Dim seqFile As SequenceFile
    Dim seq As Sequence
    Dim theStep As Step
    Dim theOtherStep As Step
    'Create the Engine
    Set theTS = New TS.Engine
    'Load the Types
    theTS.LoadTypePaletteFiles
    'Get Sequence File
    Set seqFile = theTS.GetSequenceFile()
    'Get Sequence
    Set seq = seqFile.GetSequenceByName("MainSequence")
    'Get Step
    Set theStep = seq.GetStep(0, StepGroup_Main)
    'Clone the Step
    Set theOtherStep = theStep.Clone("", 0)
    'Using the inheritance functionality
    'gets the Step Status
    'Notice that theOtherStep is not a PropertyObject
    'and you can use all the properties and methods that
    'applies to the PropertyObject Class to a Step class
    'in this example
    'Also, in VB when you are typing the statement, you
    'will not see the PropertyObject Class properties and
    'and Methods automatically if the variable is not a
    'PropertyObject type. However, you can still use them
    'as mentioned before
    MsgBox (theOtherStep.GetValString("Result.Status", 0))
    End Sub
    2. When you create or modify sequence files programatically be carefull not to break the license Agreement. You need the development lisence when modifying sequences.
    3. This piece of code is not completed, and you will need to shutdown the engine by the end.
    4. Since you are not handling UI Messages, you will need to be carefull when loading sequences that have the SequenceFileLoad Callback. The engine posts UI Messages when executing this callback. Also when you shutdown the engine, UI Messages are posted. For both operations (Load Sequence and Shuutdown) you may prevent the engine from posting the message (You may check the options parameter for this two methods in TS Programmer Help.)
    5. If you want to run a sequence, again you will need to incorporate in your code the UIMessage Handler part. (You may check the TS Programmer Help->Writing an Application Using the API->UI Messages). Otherwise it may hang since the engine posts UI Messages eventually.
    Regards,
    Roberto Piacentini
    National Instruments
    Applications Engineer
    www.ni.com/support

  • Setting value for attribute  'PO_NUMBER_SOLD'  using setter method

    Hi Experts,
    I need to set the value of a screen field according to some condition. I am using setter method of this attribute to set the value but it is not getting changed.
    I have written following code in DO_PREPARE_OUTPUT method of implementation class ZL_ZZBT131I_ZCREDITCHECK_IMPL using setter method of attribute
    Get Referral Authorization Code
          lv_val1 = me->typed_context->crechkresph->get_po_number( attribute_path = 'PO_NUMBER' ).
          me->typed_context->crechkresph->set_po_number( attribute_path = 'PO_NUMBER'
                                                            value     = ' ' ).
    while debugging I found that in method set_po_number set_property method has been used:--
    current->set_property(
                          iv_attr_name = 'PO_NUMBER_SOLD' "#EC NOTEXT
                          iv_value     = <nval> ).
    In set_property method  following code is getting executed
    if ME->IS_CHANGEABLE( ) = ABAP_TRUE and
               LV_PROPS_OBJ->GET_PROPERTY_BY_IDX( LV_IDX ) ne IF_GENIL_OBJ_ATTR_PROPERTIES=>READ_ONLY.
              if <VALUE> ne IV_VALUE.
                if ME->MY_MANAGER_ENTRY->DELTA_FLAG is initial.
                first 'change' -> proof that entity is locked
                  if ME->MY_MANAGER_ENTRY->LOCKED = FALSE.
                    if ME->LOCK( ) = FALSE.
                      return.
                    endif.
                  endif.
                flag entity as modified
                  ME->MY_MANAGER_ENTRY->DELTA_FLAG = IF_GENIL_CONTAINER_OBJECT=>DELTA_CHANGED.
                endif.
                ME->ACTIVATE_SENDING( ).
              change value
                <VALUE> = IV_VALUE.
              log change
                set bit LV_IDX of ME->CHANGE_LOG->* to INDICATOR_SET.
              endif.
            else.
            check if it is a real read-only field or a display mode violation
              assert id BOL_ASSERTS subkey 'READ-ONLY_VIOLATION'
                     fields ME->MY_INSTANCE_KEY->OBJECT_NAME
                            IV_ATTR_NAME
                     condition ME->CHANGEABLE = ABAP_TRUE.
            endif.
    and in debugging I found that if part ( ME->IS_CHANGEABLE( ) = ABAP_TRUE and
               LV_PROPS_OBJ->GET_PROPERTY_BY_IDX( LV_IDX ) ne IF_GENIL_OBJ_ATTR_PROPERTIES=>READ_ONLY) fails and hence else part is getting executed and hence my field a real read-only field or a display mode violation is happening according to comments in code.
    What shall I do so that I would be able to change the screen field value?
    Any help would be highly appreciated.
    Regards,
    Vimal

    Hi,
    Try this:
    data: lr_entity type cl_crm_bol_entity.
    lr_entity = me->typed_context->crechkresph->collection_wrapper->get_current( ).
    lr_entity->set_property( iv_attr_name = 'PO_NUMBER' value = '').
    Also, make sure the field is not read-only.
    Regards
    Prasenjit

  • Getter/setter methods -- how do I use the return values

    I'm just learning Java, and I haven't been to this site since the end of July, I think. I have a question regarding getter and setter methods. I switched to the book Head First Java after a poster here recommended it. I'm only about a hundred pages into the book, so the code I'm submitting here reflects that. It's the beginnings of a program I'd eventually like to complete that will take the entered information of my CD's and alphabetize them according to whatever criteria I (or any user for that matter) choose. I realize that this is just the very beginning, and I don't expect to have the complete program completed any time soon -- it's my long term goal, but I thought I could take what I'm learning in the book and put it to practical use as I go along (or at lest try to).
    Yes I could have this already done it Excel, but where's the fun and challenge in that? :) Here's the code:
    // This program allows the user to enter CD information - Artist name, album title, and year of release -- and then organizes it according the the user's choice according to the user's criteria -- either by artist name, then title, then year of release, or by any other order according to the user's choice.
    //First, the class CDList is created, along with the necessary variables.
    class CDList{
         private String artistName;//only one string for the artist name -- including spaces.
         private String albumTitle;//only one string the title name -- including spaces.
         private int yearOfRelease;
         private String recordLabel;
         public void setArtistName(String artist){
         artistName = artist;
         public void setAlbumTitle(String album){
         albumTitle = album;
         public void setYearOfRelease(int yor){
         yearOfRelease = yor;
         public void setLabel(String label){
         recordLabel = label;
         public String getArtistName(){
         return artistName;
         public String getAlbumTitle(){
         return albumTitle;
         public int getYearOfRelease(){
         return yearOfRelease;
        public String getLabel(){
        return recordLabel;
    void printout () {
           System.out.println ("Artist Name: " + getArtistName());
           System.out.println ("Album Title: " + getAlbumTitle());
           System.out.println ("Year of Release: " + getYearOfRelease());
           System.out.println ("Record Label: " + getLabel());
           System.out.println ();
    import static java.lang.System.out;
    import java.util.Scanner;
    class CDListTestDrive {
         public static void main( String[] args ) {
              Scanner s=new Scanner(System.in);
              CDList[] Record = new CDList[4];
              int x=0;     
              while (x<4) {
              Record[x]=new CDList();
              out.println ("Artist Name: ");
              String artist = s.nextLine();
              Record[x].setArtistName(artist);
              out.println ("Album Title: ");
              String album = s.nextLine();
              Record[x].setAlbumTitle(album);
              out.println ("Year of Release: ");
              int yor= s.nextInt();
                    s.nextLine();
              Record[x].setYearOfRelease(yor);
              out.println ("Record Label: ");
              String label = s.nextLine();
              Record[x].setLabel(label);
              System.out.println();
              x=x+1;//moves to next CDList object;
              x=0;
              while (x<4) {
              Record[x].getArtistName();
              Record[x].getAlbumTitle();
              Record[x].getYearOfRelease();
              Record[x].getLabel();
              Record[x].printout();
              x=x+1;
                   out.println("Enter a Record Number: ");
                   x=s.nextInt();
                   x=x-1;
                   Record[x].getArtistName();
                Record[x].getAlbumTitle();
                Record[x].getYearOfRelease();
                Record[x].getLabel();
                Record[x].printout();
         }//end main
    }//end class          First, I'd like to ask anyone out there to see if I could have written this any more efficiently, with the understanding that I'm only one hundred pages into the book, and I've only gotten as far as getter and setter methods, instance variables, objects and methods. The scanner feature I got from another book, but I abandoned it in favor of HFJ.
    Secondly --
    I'm confused about getter and setter methods -- I'd like someone to explain to me what they are used for exactly and the difference between the two. I have a general idea, that getters get a result from the method and setters set or maybe assign a value to variable. I submitted this code on another site, and one of the responders told me I wasn't using the returned values from the getter methods (he also told me about using a constructor method, but I haven't got that far in the book yet.). The program compiles and runs fine, but I can't seem to figure out how I'm not using the returned values from the getter methods. Please help and if you can explain in 'beginners terms,' with any code examples you think are appropriate. It will be greatly appreciated.
    By the way, I'm not a professional programmer -- I'm learning Java because of the intellectual exercise and the fun of it. So please keep that in mind as well.
    Edited by: Straitsfan on Sep 29, 2009 2:03 PM

    Straitsfan wrote:
    First, I'd like to ask anyone out there to see if I could have written this any more efficiently, with the understanding that I'm only one hundred pages into the book, and I've only gotten as far as getter and setter methods, instance variables, objects and methods. The scanner feature I got from another book, but I abandoned it in favor of HFJ.Yes, there is tons you could have done more efficiently. But this is something every new programmer goes through, and I will not spoil the fun. You see, in 3 to 6 months when you have learned much more Java, assuming you stick with it, you will look back at this and be like "what the hell was I thinking" and then realize just haw far you have come. So enjoy that moment and don't spoil it now by asking for what could have been better/ more efficient. If it works it works, just be happy it works.
    Straitsfan wrote:
    Secondly --
    I'm confused about getter and setter methods -- I'd like someone to explain to me what they are used for exactly and the difference between the two. I have a general idea, that getters get a result from the method and setters set or maybe assign a value to variable. I submitted this code on another site, and one of the responders told me I wasn't using the returned values from the getter methods (he also told me about using a constructor method, but I haven't got that far in the book yet.). The program compiles and runs fine, but I can't seem to figure out how I'm not using the returned values from the getter methods. Please help and if you can explain in 'beginners terms,' with any code examples you think are appropriate. It will be greatly appreciated.
    By the way, I'm not a professional programmer -- I'm learning Java because of the intellectual exercise and the fun of it. So please keep that in mind as well.First, if you posted this somewhere else you should link to that post, it is good you at least said you did, but doubleposting is considered very rude because what inevitably happens in many cases is the responses are weighed against each other. So you are basically setting anyone up who responds to the post for a trap that could make them look bad when you double post.
    You are setting you getters and setters up right as far as I can tell. Which tells me that I think you grasp that a getter lets another class get the variables data, and a setter lets another class set the data. One thing, be sure to use the full variable name so you should have setRecordLabel() and getRecodLabel() as opposed to setLabel() and getLabel(). Think about what happens if you go back and add a label field to the CDList class, bad things the way you have it currently. Sometimes shortcuts are not your friend.
    And yes, you are using the getters all wrong since you are not saving off what they return, frankly I am suprised it compiles. It works because you don't really need to use the getters where you have them since the CDList Record (should be lowercase R by the way) object already knows the data and uses it in the printout() method. Basically what you are doing in lines like:
    Record[x].getArtistName();is asking for the ArtistName in Record[x] and then getting the name and just dropping it on the floor. You need to store it in something if you want to keep it, like:
    String artistName = Record[x].getArtistName();See how that works?
    Hope this helped, keep up the good learning and good luck.
    JSG

  • Problem exporting crystal PDF using printoutputController.export method

    Has anyone used PrintOutputController().export() method in ReportClientdocument to export Crystal PDF report to a JavaIOStream. I am getting an error when I try to export it using this method. The error I get is unable to connect RAS.rptappsrver followed by classcast unable to export to IXMLSerializable. Here is the code I am using.
    Is there some setting I need to enable on the server to use the export function or any other idea will be appreciated?
    IReportAppFactory reportAppFactory = (IReportAppFactory) enterpriseSession.getService("","RASReportFactory");
    ReportClientDocument reportClientDoc = reportAppFactory.openDocument(reportID, 0, Locale.ENGLISH);
    return reportClientDoc.getPrintOutputController().export(exportOptions);
    Here is the exact Exception:
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException: Unable to connect to the server: FICLDEV303VWIN.RAS.rptappserver. --- com/crystaldecisions/sdk/occa/report/exportoptions/ReportExportFormat incompatible with com/crystaldecisions/xml/serialization/IXMLSerializable---- Error code:-2147217387 Error code name:connectServer
    Caused by:
    java.lang.ClassCastException: com/crystaldecisions/sdk/occa/report/exportoptions/ReportExportFormat incompatible with com/crystaldecisions/xml/serialization/IXMLSerializable
         at com.crystaldecisions.proxy.remoteagent.FetchReportViewingRequest.saveContents(Unknown Source)
         at com.crystaldecisions.proxy.remoteagent.FetchReportViewingRequest.save(Unknown Source)
         at com.crystaldecisions.xml.serialization.XMLObjectSerializer.save(Unknown Source)
         at com.crystaldecisions.sdk.occa.managedreports.ras.internal.CECORBACommunicationAdapter.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.managedreports.ras.internal.CECORBACommunicationAdapter.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.managedreports.ras.internal.CECORBACommunicationAdapter.request(Unknown Source)
         at com.crystaldecisions.proxy.remoteagent.z.a(Unknown Source)
         at com.crystaldecisions.proxy.remoteagent.s.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.cf.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
         at com.fmr.fic.fund2fund.web.servlet.CrystalReportServlet.getReportByteStream(CrystalReportServlet.java)
         at com.fmr.fic.fund2fund.web.servlet.CrystalReportServlet.processUsingReportExportControl(CrystalReportServlet.java)
         at com.fmr.fic.fund2fund.web.servlet.CrystalReportServlet.doGet(CrystalReportServlet.java:128)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212)
         at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:629)
         at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2837)
         at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:220)
         at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:204)
         at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1681)
         at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77)
         at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:421)
         at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:367)
         at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:94)
         at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:548)
         at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:601)
         at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:934)
         at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1021)
         at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)
    I
    Is there some setting I need to enable on the server to use the export function or any other idea will be appreciated?
    Edited by: Dilshad Ahmed on Nov 5, 2008 5:55 PM
    Edited by: Dilshad Ahmed on Nov 5, 2008 6:09 PM

    Here is the answer. After getting ReportClientDoc from factory we need to set the DatabaseController userid and password (if report on Crystal server is accessing oracle database as datasource). In addition we need to set parameters on the ReportClientDoc for reports and subreports before doing the the export.
    Here is snippet of code: The code below is used to get ReportClientDocument and export it as PDF using bytestream.
    /* Code for getting report client document */
    private static synchronized ReportClientDocument getReportClientDocument() throws Exception
             int count = 3;
             ReportClientDocument rpt = null;
             while (count > 0 && rpt == null)
                  try
                       if (_enterpriseSession == null)
                            ISessionMgr _sessionMgr = CrystalEnterprise.getSessionMgr();
                            _enterpriseSession = _sessionMgr.logon(CRYSTAL_USERID, CRYSTAL_PASSWORD, CRYSTAL_SERVER, CRYSTAL_AUTH);
                             LOG.info("Successful Logging into Crystal Server: " + CRYSTAL_SERVER);
                             _reportAppFactory = (IReportAppFactory)_enterpriseSession.getService("", "RASReportFactory");
                             _infoStore = (IInfoStore)_enterpriseSession.getService("InfoStore");
                             IInfoObjects result = _infoStore.query("Select SI_ID, SI_NAME From CI_INFOOBJECTS Where SI_NAME = '" + CRYSTAL_REPORT_NAME + "' And SI_INSTANCE = 0");
                             IInfoObject infoObject = (IInfoObject)result.get(0);
                             _reportId = infoObject.getID();
                             LOG.info("Located Report Id on Crystal Server: "+_reportId);
                        LOG.info("Created or found CR session");
                        rpt = _reportAppFactory.openDocument(_reportId, 0, Locale.ENGLISH);
                        break;
                  catch (Exception e)
                       rpt = null;
                       _enterpriseSession = null;
                       if (--count == 0)
                            throw e;
              return rpt;
    /* report for setting parameter */
    private synchronized void setReportParameters(ParameterFieldController fieldController, String reportName,
                  String[] reportParameterValues,     DataDefController subDataController) throws SalesforceException
             try
                  Fields params = subDataController.getDataDefinition().getParameterFields();
                   for (Iterator it = params.iterator(); it.hasNext();)
                        ParameterField paramField = (ParameterField)it.next();
                        int paramIndex = getElementIndex(_reportParameters, paramField.getName());
                        if (paramIndex < 0)
                             throw new SalesforceException("Parameter not defined in the configuration");
                        ParameterFieldDiscreteValue dVal = new ParameterFieldDiscreteValue();
                        dVal.setValue(reportParameterValues[paramIndex]);
                        fieldController.setCurrentValue(reportName, paramField.getName(), dVal);
                   LOG.info("Completed setting parameters for report " + reportName);
             catch (ReportSDKException e)
                   LOG.error("Set Report Parameters error: ", e);
                   throw new SalesforceException("Set Report Parameters error", e);
         catch (Exception e)
                   LOG.error("Error from getElementIndex: ", e);
                   throw new SalesforceException("Set Report Parameters error", e);
    /* main method used to getReport based on passing information */
        private synchronized byte[] getReport(String contactId) throws SalesforceException
             try
                  String[] reportParameterValues =
                       new String[] {_sessionId, _viewId, _requestId, contactId, _language};
                   DataDefController reportDefController = reportClientDoc.getDataDefController();
                   reportParameterValues[0] = (_cache.equalsIgnoreCase("true") ? "CACHE:Main" : "Main");
                   setReportParameters(reportDefController.getParameterFieldController(), null,
                             reportParameterValues, reportDefController);//.getDataDefinition().getParameterFields());
                   IStrings subRepNames = reportClientDoc.getSubreportController().getSubreportNames();
                   for (Iterator iname = subRepNames.iterator(); iname.hasNext();)
                        String subName = (String)iname.next();
                        reportParameterValues[0] = (_cache.equalsIgnoreCase("true") ? "CACHE:" : "") + subName;
                        setReportParameters(reportDefController.getParameterFieldController(), subName, reportParameterValues,
                                  reportClientDoc.getSubreportController().getSubreport(subName).getDataDefController());//.getDataDefinition().getParameterFields());
                   InputStream is = reportClientDoc.getPrintOutputController().export(ReportExportFormat.PDF);
                 byte[] reportBinaries = new byte[is.available()];
                 is.read(reportBinaries);
                 is.close();
                 LOG.info("Completed exporting Crystal Report as InputStream using export() method: "+contactId);
                 return reportBinaries;
             catch (ReportSDKException e)
                   LOG.error("Report generating error: ", e);
                   throw new SalesforceException("Report generating error", e);
             catch (IOException e)
                   LOG.error("Report exporting error: ", e);
                   throw new SalesforceException("Report exporting error", e);

  • I'm having problem  with my icloud account,I don't have access to the email i once used to set up my icloud account,this is really affecting me,I can't backup and restore anything from my phone and device..anybody can help?

    I'm having problemĀ  with my icloud account,I don't have access to the email i once used to set up my icloud account,this is really affecting me,I can't backup and restore anything from my phone and device..Can somebody help?

    Hi Maastricht2014,
    Until and unless you remember the password to your old email address, you will not be able to access the eBooks as those eBooks are only authorized with your old email address only.
    The only workaround or alternative to access your eBooks will be to contact the eBook vendor and ask them to migrate the eBook from your old email to the new one.
    Hope that Helps!
    ~ Arpit

  • Set Methods are not running

    I am writing my first jsp. I have a bean that I am wanting to use and my understanding is that if I put the following commands in, that all the set methods for my properties will run in the bean automatically as long as the names of the properties are the same as those on the form.
    <jsp:useBean id="MedicalBean" class="Project5.MedicalReimbursementRecord" scope="session"/>
    <jsp:setProperty name="MedicalBean" property="*"/>
    The form has a number of textboxes, each text box has a name of one of the properties in my bean. I put display in my bean and I know that it is never running any of the "set" methods for any of the properties. I know that it is indeed getting into my bean, as I have displayed which indicate that methods that I request are indeed running.
    I have not "ACTION" parameter on the FORM, but I have looked at the examples in Tomcat and they have forms which do not have an "Action". I don't think this is a problem, but maybe I am wrong about that. If I put in the statement of:
    <jsp:setProperty name="MedicalBean" property="GrpAcctNbr"/>
    Then I get the error "Cannot find any information on property 'GrpAcctMbr' in a bean of type 'Project5.MedicalReimbursementRecord'"
    So there must be something wrong with my setProperty statement, but what is it?
    Thanks in advance for your assistance.

    Can you show the relevant JSP code and set/get methods in the bean?
    Sometimes this error is caused by capitalization. e.g. a request param of "myName" calls setMyName(). Also, your bean must have a no arguments constructor.
    Also, if you don't specify an action,the form submits to the current URL so you should be ok. Are you sure that the JSP runs when the user submits the form?

  • Confusion about get/set method not working

    Hi
    Hopefully someone can point out the elementary mistake I have made in my code. I have created a get/set method to hold a value"total" so that I can then get it to display it further down my code in an HTML page. I am setting the value as I can check this by printing it out (line 102) but when I try to use it again it displays 0.0. What have I done wrong?
    class ReportListener implements ActionListener
         Context context;
         ResultSet resultAll;
         ResultSet resultTotal;
         JFrame frame;
         int daysInMonth;
         int i;
         DisplayCurrencyOnBills d;
         DateFormatSymbols symbols;
         String[] newWeekday;
         Date theDate;
         String date;
         ReportListener (Context theContext)
              context = theContext;
         public void actionPerformed(ActionEvent e)
           try
              printWeeklyReport();
              //countDaysInMonth();
              getReportMoneyTotal();
         catch (SQLException s)
                   s.printStackTrace();
         public void countDaysInMonth()
         public void getReportMoneyTotal() throws SQLException
              Calendar todayTotal =Calendar.getInstance() ;
               SimpleDateFormat reportDateFormat = new SimpleDateFormat("dd MM yyyy");
              PreparedStatement preparedT =context.getConnection().prepareStatement(
                   "SELECT Sum(tblSession.Fee) AS Total, Count(tblBooking.BookingID) AS CountOfBookingID FROM tblSession INNER JOIN "+
                   "(tblBooking INNER JOIN tblCustomer_Booking ON tblBooking.BookingID = tblCustomer_Booking.BookingID) ON tblSession.SessionID = tblBooking.SessionID "+
                   "WHERE (((tblBooking.EventDate)>DateAdd('m',-1,#"+reportDateFormat.format(todayTotal.getTime())+"#)) AND ((tblSession.Session)='Morning' Or (tblSession.Session)='Evening')) OR (((tblSession.Session)='Afternoon') AND ((tblBooking.Extension)=Yes))"
              ResultSet resultTotal =preparedT.executeQuery();
              resultTotal.next();
              double total =resultTotal.getDouble("Total");     
              context.setReportIncomeTotal(total);
              System.out.println("Line 102 "+context.getReportIncomeTotal());
              preparedT.close();
         public void printWeeklyReport() throws SQLException
              Calendar today =Calendar.getInstance() ;
               SimpleDateFormat reportDateFormat = new SimpleDateFormat("dd MM yyyy");
              PreparedStatement prepared =context.getConnection().prepareStatement(
                   "SELECT tblBooking.EventDate, tblSession.Session, tblBooking.Extension, tblSession.Fee, Count(tblBooking.BookingID) AS CountOfBookingID "+
                   "FROM tblSession INNER JOIN (tblBooking INNER JOIN tblCustomer_Booking ON tblBooking.BookingID = tblCustomer_Booking.BookingID) ON "+
                   "tblSession.SessionID = tblBooking.SessionID GROUP BY tblBooking.EventDate, tblSession.Session, tblBooking.Extension, tblSession.Fee "+
                   "HAVING (((tblBooking.EventDate)>DateAdd('m',-1,#"+reportDateFormat.format(today.getTime())+"#)) AND ((tblSession.Session)='Morning' Or "+
                   "(tblSession.Session)='Evening')) OR (((tblSession.Session)='Afternoon') AND ((tblBooking.Extension)=Yes))"
              ResultSet resultAll =prepared.executeQuery();
              resultAll.next();
              System.out.println("Line 123 "+context.getReportIncomeTotal());
                        PrintWriter printWriter;
                        try
                             JFileChooser fc=new JFileChooser();
                             int returnVal = fc.showSaveDialog(frame);
                             if (returnVal != JFileChooser.APPROVE_OPTION)
                                  return;
                             FileOutputStream outputStream=
                                  new FileOutputStream(fc.getSelectedFile());
                             OutputStreamWriter writer=
                                  new OutputStreamWriter(outputStream,"UTF-8");
                             printWriter=new PrintWriter(writer);     
                           printWriter.println("<html><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><body><h1>Monthly Usage Statistics</h1>");
                           printWriter.println("<table width='100%' border='1'><tr><td width='100%' colspan='8'><h2 align='center'>Monthly Summary</h2></td></tr>");
                         System.out.println("Line 152 "+context.getReportIncomeTotal());
                         int count = 0;
                             while ( resultAll.next() )
                              count++;
                              String session = resultAll.getString("Session");
                              Double fee= resultAll.getDouble("Fee");
                           // display currency correctly
                         //double d=Double.parseDouble(fee);
                         Locale locale = new Locale("GBP");
                         NumberFormat gbpFormat = NumberFormat.getCurrencyInstance(locale);
                             symbols = new DateFormatSymbols(new Locale("en"));
                         newWeekday =symbols.getWeekdays();
                             SimpleDateFormat formatter = new SimpleDateFormat("EEEE",symbols);
                             Date theEventDate = new Date();
                             theEventDate=resultAll.getDate("EventDate");
                             date = formatter.format(theEventDate);
                             // set date for Usage Report
                             Calendar reportDate = Calendar.getInstance();
                             Calendar reportToday =Calendar.getInstance();
                             reportDate.add(Calendar.MONTH,-1);
                             SimpleDateFormat reportFormat = new SimpleDateFormat("EEEE ,dd MMM yyy");     
                             //setDecimalFormat for report total
                             DecimalFormat decFormat = new DecimalFormat(".##");
                             printWriter.println(
                             "<tr><td width='100%' colspan='8'>For month from "+reportFormat.format(reportDate.getTime())+" to "+reportFormat.format(reportToday.getTime())+"</td></tr><tr><td width='100%' colspan='8'>Total amount of income from occasional bookings "+decFormat.format(context.getReportIncomeTotal())+"</td>"+
                               "</tr><tr><td width='100%' colspan='8'>Percentage use for all bookings</td></tr><tr><td width='8%'></td><td width='8%'>MON</td><td width='9%'>TUES</td>"+
                            "<td width='9%'>WEDS</td><td width='9%'>THURS</td><td width='9%'>FRI</td><td width='9%'>SAT</td><td width='9%'>SUN</td></tr><tr><td width='8%'>AM</td><td width='8%'></td>"+
                            "<td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td></tr><tr><td width='8%'>PM</td><td width='8%'></td>"+
                            "<td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td></tr><tr><td width='8%'>EVE</td><td width='8%'></td>"+
                            "<td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td></tr>"
                             System.out.println(count);
                             printWriter.println("</table>");
                             printWriter.println("</body></html>");
                             printWriter.close();
                             prepared.close();
                             JDialog reportDialog=new JDialog(frame);
                             reportDialog.setSize(800,600);
                             JEditorPane editorPane=new JEditorPane(fc.getSelectedFile().toURL());
                             editorPane.setContentType("text/html; charset=UTF-8");
                             reportDialog.getContentPane().add(editorPane);
                             reportDialog.setVisible(true);
                        catch (IOException exception)
                             exception.printStackTrace();
         This code finds data from a database(this works as it also prints a report). Here is the extraxt of my get/set method which is located in a "context" class.
    public void setReportIncomeTotal(double total)
              this.total=total;
         public double getReportIncomeTotal()
              return total;
         }I'd be grateful for any help.

    but when I try to use it again it displays 0.0This seems to mean that either the value has been reset or you are calling the method on another (new) ReportListener.
    It's hard to say, as you didn't provide us with the code sample that illustrate the corresponding scenario (did you?.)
    Note that I didn't get into details, but I just noticed that your actionPerformed method first print weekly report, and then get the money total. (Shouldn't it be the opposite order?)

  • There is no printer output when using the PrintOut method

    I have a VB6 app with CR XI, and a customer found a situation that when printing a report directly to the printer using the PrintOut method, there is no printer output or error message.
    Some reports using the same code print normally, but a report that is preceded by another print call, presents this behavior.
    And when the output is directed to the screen, we can see the report.
    Could someone give me an idea of what is the problem?
    Thanks,
    Isis
    SP - Brazil
    The code used is below:
                       Set rpt = applic.OpenReport(App.Path & "SEFoto" + TipoRPT + ".rpt")
                       rpt.FormulaSyntax = crCrystalSyntaxFormula
                       rpt.FormulaFields.GetItemByName("Empresa").Text = "'" + Company + "'"
                       rpt.FormulaFields.GetItemByName("Idioma").Text = "'" + Idioma + "'"
                       rpt.FormulaFields.GetItemByName("Versao").Text = "'" + Versao + "'"
                       ' ... Some lines to compose the selection formula
                       rpt.RecordSelectionFormula = Cond
                       ' To evaluate the image length:
                       Arq = rsTMP3!FT_Arquivo
                       ImageScaling = FatorDeReducao(Arq, "F")
                       ' To reduce the image length:
                       AchouOLE = False
                       For Each oSection In rpt.Sections
                           For Each oObject In oSection.ReportObjects
                               If oObject.Name = "PictureFoto" Then
                                  Set oOleObject = oObject
                                  AchouOLE = True
                                  Exit For
                               End If
                           Next oObject
                           If AchouOLE Then Exit For
                       Next oSection
                       With oOleObject
                            .Suppress = True
                            .XScaling = ImageScaling    ' 0.5 = 50%, 1 = 100%
                            .YScaling = ImageScaling
                            .Suppress = False
                       End With
                       Aguarde.Show 1
                       If DestinoRel = 9 Or DestinoRel = 1 Then ' Padrão ou impressora
                          rpt.PrintOut True              ' <<<---- Here using true or false nothing happens
                       Else
                          PrintRPTtela rpt, "Fotos"   ' <<<--- Here it works fine
                       End If

    Hi Isis,
    Not sure if you have applied any service Packs to CR? If please do so and test again. Then you can upgrade to CR XI R2 for free, use your XI Keycode and download Service Pack 4 from this link:
    https://smpdl.sap-ag.de/~sapidp/012002523100011802732008E/crxir2_sp4_full_build.exe
    You'll find the distribution files for your app also from that same download area.
    If you don't want to upgrade to XI R2 then download all patches from XI and test again. This issues rings a bell that it may have been fixed.
    Thank you
    Don

  • How to change calendar setting for one event in a repeating series?

    Is there any way to change the calendar setting (color) for a single event in a repeating series without changing the color of all events in that series? It seems one event in a repeating series is linked to all other events in that series even if you change the time and/or date first.
    The only workaround I've found is to create a new event Identical to the event in question except with the different calendar, then delete the original event. This would be a lot easier if the OS would ask the user if s/he wants to apply the calendar change to all future events or just this one. Or if there was a way to more easily duplicate a single event, that would also save me a lot of time.
    Thanks for any responses.

    The assignment of colors to calendars on your iPad is pretty simplistic. You can set a color for each calendar and all events (repeating or single instance) placed in a calendar use the calendar's color; however, you cannot set a color for one instance of a calendar event. The workaround you came up with is similar to the method I use. I have a calendar labeled "Priority Events" (Red) that I use for important instances of standing meetings. Oftentimes I leave the event in question in the calendar and simply place a priority event in the same time slot; it clutters up the calendar a bit but helps me visually.

Maybe you are looking for