Results 1 to 7 of 7

Thread: [RESOLVED] Set top property of text object and field object of crystal reports during runtime

  1. #1

    Thread Starter
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,020

    Resolved [RESOLVED] Set top property of text object and field object of crystal reports during runtime

    Hi,

    In my reports, i have four controls.

    1. Comments (Text Object) and Comments (Field object )w/ top properties of 3465.

    2. Recommendations (Text Object) and Recommendations (Field object ) w/ top properties of 4505.

    Here's what i need to do..

    Logic:

    Code:
    if ((recommendations field object != null) && (comments field object == null)))
           If true, set top properties of Recommendations Text object and commendations Field object to 3465.
    How can we check if a field object has text/contents in C#/vb.net code? Is this possible?

    If not, Is there a workaround solution for this??


    Regards,

    Greg
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,086

    Re: Set top property of text object and field object of crystal reports during runtim


  3. #3

    Thread Starter
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,020

    Re: Set top property of text object and field object of crystal reports during runtim

    Pirate,

    Tnx for the link..But my scenario does not involve parameters..It will retrieve a data from field object control in crystal reports..

    Based from my research, .NET does not support retrieving the value from a field object..

    My problem is how can i set the top property of text object control and field object control during runtime..

    Tnx

    Greg
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  4. #4
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Set top property of text object and field object of crystal reports during runtim

    One technique is to use a simple Report Formula.

    Code:
    If IsNull ({comments field object}) Then
       "Recommendations: " & {Recommendations field object}
    Else
      (
       "Comments : " & {comments field object} & chr(13) & 
       "Recommendations: " & {Recommendations field object}
      )
    Replace the 4 objects on the report with the Formula object. Make sure its Can Grow property is set to true. The above code assumes the Recommendations field is never Null.

    Let me know if that doesn't work for you and I will reply with another technique.
    Last edited by brucevde; Jul 30th, 2010 at 08:38 AM.

  5. #5

    Thread Starter
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,020

    Re: Set top property of text object and field object of crystal reports during runtim

    hi bruce,

    Just got the available time to reply this post.

    The idea of substituting the field and text objects to formula fields was a solution..

    What i did was, I added 4 formula fields in the report..The left side control
    functions as the label, while the right side gets the data from data table..

    Each control has its own formula... If recommendations is not null and comments is null, the data will be shown in the comments formula field...And the formula fields for recommendations (label and data field) will be suppressed..

    Thanks for the tip...You mentioned earlier that there's another technique...What is behind this technique? Still formula fields?

    Greg
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  6. #6
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: [RESOLVED] Set top property of text object and field object of crystal reports du

    The other technique involves using multiple detail sections, setting the option "Underlay Following Section" and suppressing report objects. It all depends on the layout of the report but here is a simple example.


    Code:
    Details a    Other Field Objects       Comments (Text Object)             Comments (Field object )
    Details b                              Recommendations (Text Object)      Recommendations (Field object )
    If Customer 1 has both a Comment and a Recommendation but Customer 2 only had a Recommendation the report output would be

    Code:
    Customer 1              Comments: Some long comments
                     Recommendations: Cancel their account
    
    Customer 2              Comments:
                     Recommendations: Raise their credit limit.
    But by setting the following 3 Formulas to IsNull({Comments Database Field})

    Details A Section "Underlay Following Section" option
    Comments Text object Suppress option
    Comments Field object Suppress option

    The above report will produce

    Code:
    Customer 1              Comments: Some long comments
                     Recommendations: Cancel their account
    
    Customer 2       Recommendations: Raise credit limit.
    Last edited by brucevde; Aug 1st, 2010 at 01:19 AM.

  7. #7

    Thread Starter
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,020

    Re: [RESOLVED] Set top property of text object and field object of crystal reports du

    Thanks bruce..

    I'll put this under my signature as future reference..

    Greg
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width