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

Funky error on calc field

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

    Funky error on calc field

    See the attached message. I get it when I try to create this calculated field:

    bar = = ""img SRC=\"c:/TEAM/redstripe.gif\" ALT=\"_________\" WIDTH=\""+ alltrim(str(Rating/maximum(Rating)*400))+"\" HEIGHT=\"5\" BORDER=\"0\" ""

    I plan on using it to display a bar graph using HTML. It is meant to be only a character field. When I enter it in the expression builder it shows it is OK but does not display the last part starting at border (see second attachment). When I try to save it, I get the error I mentioned at the beginning.

    At first I thought maybe it was because I started the component in the beta, but I get the same error when I create a new component as well.

    Thanks in advance for any help.

    Howard
    Howard G. Cornett, Independent Consultant

    #2
    RE: Funky error on calc field

    it looks like there is a pretty stupid error in the grid component. i have fixed it. in the mean time the work around is easy.

    the problem is that you can't use = signs in the expression for a calculated field. the work around is to use chr(61) which is the same as =

    so, instead of "src=image.jpg" you would write :

    "src" + chr(61) + "image.jpg".

    the fix allowing = signs in calc fields will be in next patch.

    very sorry about this.

    Comment


      #3
      RE: Funky error on calc field

      Selwyn

      Thanks for the fix, but I still get the error. And the result in the expression builder still stops at height = "5". Any ideas why?

      Howard
      Howard G. Cornett, Independent Consultant

      Comment


        #4
        RE: Funky error on calc field








        New Page 1




        The expression that you said you were trying to use is:
        ""img SRC=\"c:/TEAM/redstripe.gif\" ALT=\"_________\"
        WIDTH=\""+ alltrim(str(Rating/maximum(Rating)*400))+"\" HEIGHT=\"5\"
        BORDER=\"0\" ""
        This cannot work because it contains errors. This part of the above
        expression is wrong: alltrim(str(Rating/maximum(Rating)*400))

        You need to fix this. I would help, but I don't know what you are trying
        to do here. You can tell it is wrong by testing it in the Interactive window
        (after first creating a variable called 'Rating' and assigning a test value to
        the variable).

        If you replace the part of your expression that is wrong with a temporary
        'placeholder' ("ratingsubexpression"), and replace the = signs with chr(61),
        then you get the correct expression that you need to enter in the grid:
        ""img SRC"+chr(61)+"\"c:/TEAM/redstripe.gif\" ALT"+chr(61)+"\"_________\"
        WIDTH"+chr(61)+"\""+ "ratingsubexpression"+"\" HEIGHT"+chr(61)+"\"5\"
        BORDER=\"0\" ""
        If you were to test the above expression in the Interactive window, you
        would get:
        "img SRC="c:/TEAM/redstripe.gif" ALT="_________" WIDTH="ratingsubexpression"
        HEIGHT="5" BORDER="0" "





        Comment


          #5
          RE: Funky error on calc field

          I've almost got it now. The only problem is that if I display it as an image, it does not allow me to change the width based on the calculated field. As a result, I used control type label but that also doesn't work. I think it may be because the HTML escape characters are substituted so that the page displays the text rather than rendering the image. Here is the text from the HTML window

          Code:
          	AAUK 
          	11/01/2002 
          	5 
          	75 
          	4 
          	76 
          	"img SRC="c:/a5webroot/CoreCapital/default/redstripe.jpg" ALT="_________" WIDTH="271.429" HEIGHT="5" BORDER="0""
          Howard G. Cornett, Independent Consultant

          Comment


            #6
            RE: Funky error on calc field

            I've almost got it now. The only problem is that if I display it as an image, it does not allow me to change the width based on the calculated field. As a result, I used control type label but that also doesn't work. I think it may be because the HTML escape characters are substituted so that the page displays the text rather than rendering the image. Here is the text from the HTML window

            "td class="EncyclopaediaDataTD""AAUK "/td"
            "td class="EncyclopaediaDataTD""11/01/2002 "/td"
            "td class="EncyclopaediaDataTD"""DIV style="text-align: right;""5 "/DIV""/td"
            "td class="EncyclopaediaDataTD"""DIV style="text-align: right;""75 "/DIV""/td"
            "td class="EncyclopaediaDataTD"""DIV style="text-align: right;""4 "/DIV""/td"
            "td class="EncyclopaediaDataTD"""DIV style="text-align: right;""76 "/DIV""/td"
            "td class="EncyclopaediaDataTD""<img SRC="c:/a5webroot/CoreCapital/default/redstripe.jpg" ALT="_________" WIDTH="271.429" HEIGHT="5" BORDER="0"> "/td"
            Howard G. Cornett, Independent Consultant

            Comment


              #7
              RE: Funky error on calc field

              if you choose label, then a5 will htmlencode the data. that's NOT what you want.

              you have to choose image because that's what it is.

              what do you mean by this: "it does not allow me to change the width based on the calculated field"

              are you trying to control the display width of the column?

              if so, then this is easily done using inline styles. for example if you set the 'cell in-line style' for the image column to :

              width: 3in;

              then that will set the column width to 3 in. you can use the pop up style builder for the inline style. the width property is on the 'position' tab of the style editor.

              Comment


                #8
                RE: Funky error on calc field

                I have tried to set the width as you described using an A5 expression, but it doesn't seem to work. How can I change the width based on the value in the current record? What I have tried ends up looking like this:

                "td class="EncyclopaediaAltDataTD""AAPL "/td"
                "td class="EncyclopaediaAltDataTD""11/01/2002 "/td"
                "td class="EncyclopaediaAltDataTD"""DIV style="text-align: right;""5 "/DIV""/td"
                "td class="EncyclopaediaAltDataTD"""DIV style="text-align: right;""59 "/DIV""/td"
                "td class="EncyclopaediaAltDataTD"""DIV style="text-align: right;""4 "/DIV""/td"
                "td class="EncyclopaediaAltDataTD"""DIV style="text-align: right;""60 "/DIV""/td"
                "td class="EncyclopaediaAltDataTD"""img style="height: 5px; width: "%a5 Rating/maximum(ratings-"Ratings)*400%"px;" src="C:\Team\Corecapital.WebProjects\Default.WebProject\redstripe.jpg" alt=""" "/td"

                It doesn't work because it never resolves the formula into a number for the width. Perhaps the formula in incorrect? I am trying to calculate the fraction of the largest value the current record is. I want to take the current Rating (a field value) and divide it by the maximum value that Rating has in the table. Then I want to multiply the result by 400. Finally, I want the width of the image displayed to match the result of this calculation. Am I doing it wrong? Is there a better way?

                Howard
                Howard G. Cornett, Independent Consultant

                Comment


                  #9
                  RE: Funky error on calc field






                  New Page 2




                  this is not legal:

                  "%a5 Rating/maximum(ratings-"Ratings)*400%"

                  you can escape to xbasic in the property definition.
                  you can achieve the same effect by setting the value for this property in
                  xbasic.
                  if you edit the page that contains the component, you will see in the "Head"
                  section of the page there is xbasic code that loads the component. a pointer
                  variable is assigned when the component is loaded.
                  immediately after the command the loads the component is a
                  with varname
                  end with
                  sequence. Inside this with...end with you can set any of the component
                  properties.

                  Comment


                    #10
                    RE: Funky error on calc field

                    i meant to say "you can not escape to xbasic in the property definition"

                    Comment


                      #11
                      RE: Funky error on calc field

                      Thanks, Selwyn! What are the component properties and how exactly do I set them to change the formatting for image (the width, that is)?

                      Howard
                      Howard G. Cornett, Independent Consultant

                      Comment


                        #12
                        RE: Funky error on calc field

                        when you place a component on a page there is a prompt "override any of the component settings".

                        after you place the component on the page, if you switch to source view you will see something like this:

                        tmpl_invitems = a5w_load_component("invitems")
                        with tmpl_invitems
                        with field_info[2]
                        Column.InLineStyle = "width: .5in;"
                        end with
                        componentName = "invitems"
                        end with

                        the section of code between:
                        with "tmpl_invitems" and the second "end with" is where properties of the component can be set at run time.

                        Comment


                          #13
                          RE: Funky error on calc field

                          Ok, Howard, I think I finally get it.
                          You want a grid the HTML in one of the columns looks something like this:


                          Row1
                          "img src="graph.jpg" with="1in">


                          Row2
                          "img src="graph.jpg" width="1.5in">


                          Row3
                          "img src="graph.jpg" width="1.75in">


                          Row4
                          "img src="graph.jpg" width="3in">


                          While this would be extremely easy to do if you were generating the HTML
                          using your own Xbasic script, you want to do it as part of a Grid component
                          because you want to take advantage of everything else that the Grid component
                          offers (syle sheets, paging, search, sorting etc.).
                          Unfortunately, I can't think of any way to actually achieve this with the
                          Grid component. The technique I described in an earlier message about overriding
                          the Grid component's properties does not apply to your problem because you want
                          to change a property on every row of the Grid - not for the Grid as a whole.
                          I have come up with a more generic solution which I will add in a future
                          patch. I will create a new control type called "Template". Currently, a field
                          can be an "image", "label", "textbox" etc. However, if a field's type is set to
                          'template', then you can define your own html for that column.
                          In the template, you will be able to refer to values from other columns in
                          the Grid. So, in your case, say you have a column in the Grid called 'rating'
                          and you want the width attribute to be based on this value, your template for
                          column would be:

                          "img src="graph.jpg" width="{rating}" >
                          I am not sure when I will get this done by, but I will definitely do it
                          because it is an extremely powerful feature that will dramatically extend the
                          power of the Grid component.

                          Comment


                            #14
                            RE: Funky error on calc field

                            You got it exactly, Selwyn! Thanks!

                            Howard
                            Howard G. Cornett, Independent Consultant

                            Comment


                              #15
                              RE: Funky error on calc field

                              Howard, all you need to do is define a calculated field in your grid, then use this calc field for the width part of a freeform layout. Tha attached database has a smal sample of how to do this.

                              -Lenny

                              Lenny Forziati
                              Vice President, Internet Products and Technical Services
                              Alpha Software Corporation

                              Comment

                              Working...
                              X