Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Conditional Object on a Report

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ray in Capetown
    replied
    Re: Conditional Object on a Report

    Tom
    No, no no ... well yes
    Knowing your attention to detail and precision,
    I was focussed on the accuracy of the condition statement, thinking you had found a problem with it that I just couldn't see.
    I understand now, your focus was on the context of the sample not the logic statement. I wasn't referencing the example given, just to alternative general method.
    Don't give up, I may yet find a chink in your armor.

    Leave a comment:


  • Keith Hubert
    replied
    Re: Conditional Object on a Report

    To remove the space in front of the 6.77 add ALLTRIM() as in

    if(waivername="Activity","$","")+ALLTRIM(str(AllowanceUnits,8,2))
    = "$6.77"

    Leave a comment:


  • Tom Cone Jr
    replied
    Re: Conditional Object on a Report

    No, not especially.

    Your code wouldn't run in the sample database, that's all. His report is based on a set of tables and the expression must reference the table involved. I found it easier to build and test doing it the long way. Your's is fine once its adjusted for the context of his report. Personally, I find the "long way" to be easier to understand. Your mileage may vary.

    Are you pickin' on me, or what? <grin>

    Leave a comment:


  • Ray in Capetown
    replied
    Re: Conditional Object on a Report

    Any particular reason to repeat amount twice Tom?
    I prefer simpler code as in my first example (except without the number formatting)
    Code:
    waivername="Activity   "
    Allowanceunits=6.77
    ?if(alltrim(waivername)="Activity","$"+str(AllowanceUnits,8,2,","),str(allowanceUnits,8,2,","))
    = "$    6.77"
    seems to give same result as:
    Code:
    ?if(waivername="Activity","$","")+str(AllowanceUnits,8,2)
    = "$    6.77"
    waivername="No Activity "
    ?if(waivername="Activity","$","")+str(AllowanceUnits,8,2)
    = "    6.77"

    Leave a comment:


  • Tom Cone Jr
    replied
    Re: Conditional Object on a Report

    Ray,

    You have a good idea. In the context of his report the expression for the calc field you propose would be:

    if(alltrim(contracts->waivername)="Activity","$"+str(contracts->AllowanceUnits,8,2,","),str(contracts->allowanceUnits,8,2,","))
    Thanks.

    -- tom

    Leave a comment:


  • Ray in Capetown
    replied
    Re: Conditional Object on a Report

    Originally posted by Charles Hoens View Post
    Question: Am I wrong for thinking that this should be a bit simpler?
    It can be.

    How about a calc fieldstr = if(waivername = "Activity","$","")+AllowanceUnits
    can right justify with padl()
    Conditional objects, while quite correctly useful and powerful may be overkill for a simple situation.

    Leave a comment:


  • Charles Hoens
    replied
    Re: Conditional Object on a Report

    Thank Tom. I got it to work. However, what I noticed was that if you play with the objects inside the CO, they will sometimes disappear. If I lengthen them, then they will re-appear. Are you noticing this?

    Leave a comment:


  • Tom Cone Jr
    replied
    Re: Conditional Object on a Report

    Yes, I think so. When you get more experience with the conditional object you'll see that it's very powerful and flexible.

    You call this a simple thing, but here's what has to happen to produce the result you want:

    - the AllowanceUnits field in your table is NUMERIC data
    - to display the field value as dollars Alpha must convert it to character data and then format it appropriately (commas, dollar signs etc). Dollar signs are not numeric data. Neither are commas.
    - in one object in your report you sometimes want a simple string of characters, without dollar formatting. But sometimes for the same object you want Alpha to use the dollar formatting.
    - what you want is "simple" if you use two objects in the report, but you want to use a single object.
    - the CO fills the bill by permitting you to define two "layers" either of which will appear on condition

    If you didn't use the CO you'd have to preprocess the records in the report, putting the desired string of formatted (or unformatted) characters in a different field, and then use that field in the one object you have in your report. That wastes disk space and is a clumsy workaround in my opinion, but if it floats your boat, add another field to your contracts table and create a table level field rule to define a calculated expression that stores the unformatted string in the new field if not activity, and stores the formatted string in the new field if its activity. Then change the report to drop the CO and replace it with the new field. Make sense?

    Leave a comment:


  • Charles Hoens
    replied
    Re: Conditional Object on a Report

    Thanks Tom. I'll download this and look it over.

    Question: Am I wrong for thinking that this should be a bit simpler?

    Leave a comment:


  • Tom Cone Jr
    replied
    Re: Conditional Object on a Report

    TomsReport

    - duplicated your report
    - stripped out the filter and ordering properties of the report
    - deleted your CO
    - created a new CO with two layers: IsActivity and NotActivity
    - changed the condition expressions you were using.
    notice that the expressions differ, your's did not
    - dropped the AllowanceUnits field into the NotActivity layer of
    the CO
    - discovered that could not use the numeric formatting satisfactorily
    for the IsActivity layer, so created a new calc field in the report
    to show the trimmed string equivalent of the numeric field, formatted
    as dollars.

    Hope this helps.
    Attached Files

    Leave a comment:


  • Charles Hoens
    replied
    Re: Conditional Object on a Report

    Hello!

    OK. I made up a quick sample. Please look at the report "Mgr_Contract_Report". You will see the CO in the middle of the report. Again, all I am trying to accomplish here is displaying the object "AllowanceUnits" formatted in dollars when the waivername = "Activity". Other than that, it should display as a regular number.

    Thanks.
    Attached Files

    Leave a comment:


  • Charles Hoens
    replied
    Re: Conditional Object on a Report

    Thanks Tom. I read this over again and again. However I don't think it applies to my situation. I need the CO on a report, not on a form like in the A5 example. I need the CO to determine the information in the detail line and then show the required formatted object. When I try this, all I get is a blank. If I am mistaken or don't understand, just tell me. In the meantime, I'll try and work up and example of what I am trying to do.

    Thanks.

    Leave a comment:


  • Tom Cone Jr
    replied
    Re: Conditional Object on a Report

    Charles,

    Here's a link to the help file topic.

    Leave a comment:


  • Tom Cone Jr
    replied
    Re: Conditional Object on a Report

    The AS example uses a single CO with multiple layers. That's typical. That's probably all you need.

    Leave a comment:


  • Charles Hoens
    replied
    Re: Conditional Object on a Report

    OK. Thanks Keith and Stan.

    I looked over the AlphaSports invoice. I see that it works to either show or hide the field based on the conditional properties.

    In order to get what I want, i.e. dollar formatting for the field as opposed to regular formatting, do I create two CO's and then put one over the other, or can I do it with just one? I've experimented with both ideas and can't get it to work.

    Thanks.

    Leave a comment:

Working...
X