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

Long calculated field in a grid causing Alpha to slow, then lock up

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

    Long calculated field in a grid causing Alpha to slow, then lock up

    I need the following calculated field to work in a grid.

    if(FlightNum = "c", "Championship", if(FlightNum = "1", "First", if(FlightNum = "2", "Second", if(FlightNum = "3", "Third", if(FlightNum = "4", "Fourth", if(FlightNum = "5", "Fifth", if(FlightNum = "6", "Sixth", if(FlightNum = "7", "Seventh","Eighth"))))))))

    As I build this calculated field, it works but the longer it gets ..... the more it slows down in design and in working preview to the point it hangs up.

    xBasic or java ????

    Any suggestions or work around?

    Thanks
    Tony

    #2
    Re: Long calculated field in a grid causing Alpha to slow, then lock up

    How does it work as

    Code:
    case(FlightNum = "c", "Championship", FlightNum = "1", "First",FlightNum = "2", "Second", FlightNum = "3", "Third",FlightNum = "4", "Fourth", FlightNum = "5", "Fifth", FlightNum = "6", "Sixth",FlightNum = "7", "Seventh",FlightNum = "8","Eighth")
    If you have the option you can create a user defined function and just

    ordinal(flightnum)

    Code:
    FUNCTION ordinal AS C (FlightNum AS C )
    	'set default return value
    	ordinal = ""
    	select
    		case flightnum = "C"
    			ordinal = "Championship"
    			
    		case FlightNum = "1"
    			ordinal = "First"
    			
    		case FlightNum = "2"
    			ordinal = "Second"
    			
    		case FlightNum = "3"
    			ordinal = "Third"
    			
    		'and so on
    		
    	end select
    END FUNCTION
    Last edited by Stan Mathews; 07-13-2018, 04:32 PM.
    There can be only one.

    Comment


      #3
      Re: Long calculated field in a grid causing Alpha to slow, then lock up

      Stan
      Assuming I have not made typos or mistakes.......

      First option did not work, error message said "Warning: Your expression has a circular there was a circular reference. Please fix it." ( I included screenshot)

      Second option ... Also did not work. But there were no error messages. (I also included screenshots)

      flightExpression1.PNG
      flightExpression2.PNG
      flightExpression3.PNG
      flightExpression4.PNG

      Thanks
      Tony

      Comment


        #4
        Re: Long calculated field in a grid causing Alpha to slow, then lock up

        My first suggestion was an Alpha expression equivalent to the nested if() expression you had.

        The function I posted was an xbasic function, not javascript. Possibly someone will post something similar in javascript.
        There can be only one.

        Comment


          #5
          Re: Long calculated field in a grid causing Alpha to slow, then lock up

          Tony, this formula looks like it must be coming from a database. If so, the fastest and most reliable way to handle this is with a stored procedure or a view.

          That said, when I look at the formula in your second photo, it shows your if... calculation behind it. I think you need to remove that before entering the calculation. I've had much more complex formulas than the one you show with no problem in the past, so yours should be workable.
          Pat Bremkamp
          MindKicks Consulting

          Comment


            #6
            Re: Long calculated field in a grid causing Alpha to slow, then lock up

            Maybe I should look at doing this another way.
            What I am trying to accomplish is to set the order of a grid that is grouped by the field "flight"
            "Flight" consists of the following possible choices and NEEDS TO BE ORDERED AS:

            Championship
            First
            Second
            Third
            Fourth
            Fifth
            Sixth
            Seventh
            Eighth

            But as you can see, the list of choices are not in alphabetic order.
            Each tournament can have a different number of flights.

            One tournament might have:
            Championship
            First
            Second

            (Alpha orders groups correctly by accident)

            Championship
            First
            Second

            The next tournament might have:
            Championship
            First
            Second
            Third
            Fourth

            (Alpha orders groups incorrectly)
            Championship
            First
            Fourth
            Second
            Third

            Any suggestions?
            Thanks
            Tony

            Comment


              #7
              Re: Long calculated field in a grid causing Alpha to slow, then lock up

              Hi Tony,

              What's the back end that you are using?
              The fastest way is to have a stored procedure in a database or a view with calculated fields, but it cannot work if you are using old format like DBFs

              Regards,

              Doron
              The Farber Consulting Group, Inc.

              Main Web Site: http://www.dFarber.com
              Alpha Five Development

              Comment


                #8
                Re: Long calculated field in a grid causing Alpha to slow, then lock up

                Doron
                Thanks for the reply.
                I converted from DBF to SQL about a year ago and am slowly in the process of building SQL grids from my old DBF browses.
                The learning curve has been slow ...... you know the old saying ..... "you can't teach an old dog new tricks"!! :)
                Thanks!
                Tony

                Comment


                  #9
                  Re: Long calculated field in a grid causing Alpha to slow, then lock up

                  So .... I have not been able to get this to work ...... any suggestions?

                  I need to sort a grid on the field "Flight"
                  "Flight" can only contain the following choices:

                  Championship
                  First
                  Second
                  Third
                  Fourth
                  Fifth
                  Sixth
                  Seventh
                  Eighth

                  The order needs to be:
                  Championship (always needs to be first)
                  THEN all the others in "numeric" order, not alphabetic order

                  In my old DBF app, I was able to use another field "FlightNum" that had the choices 1 thru 9

                  "Flight" was a calculated field
                  If FlightNum = 1, then Flight would be Championship
                  If FlightNum = 2, then Flight would be First
                  If FlightNum = 3, then Flight would be Second
                  If FlightNum = 4, then Flight would be Third
                  If FlightNum = 5, then Flight would be Fourth
                  Etc ....

                  I would view a browse ordered by the field FlightNum

                  Thanks for any and all suggestions
                  Tony

                  Comment


                    #10
                    Re: Long calculated field in a grid causing Alpha to slow, then lock up

                    Tony,

                    You should be able to do all of this in your SQL query. Are you using MySQL, Microsoft SQL Server, or something else? Can you share the SQL query you are currently using to populate the grid? Depending on the backend server you are using it should be easy for one of us to write a conditional statement in SQL to handle this issue.

                    In your database, can you store the Championship FlightNum as 0 instead of "C"? Then you can sort by FlightNum but display the Flight field. If you are using SQL Server 2012 or newer, the CHOOSE function would make this easy.

                    Ben

                    Comment


                      #11
                      Re: Long calculated field in a grid causing Alpha to slow, then lock up

                      Morning Ben,

                      I am using Microsoft SQL Server 2014 Management Studio.

                      My SQL statement is:

                      SELECT V_Teams.Team_ID, V_Teams.Tourn_ID, V_Teams.SunAMPM, V_Teams.Flight, V_Teams.NAMES, V_Teams.SatScore, V_Teams.SunHole, Tournaments.Active
                      FROM V_Teams V_Teams
                      INNER JOIN Tournaments Tournaments
                      ON V_Teams.Tourn_ID = Tournaments.Tourn_ID
                      WHERE active = 'yes'
                      ORDER BY V_Teams.Flight, V_Teams.SatScore

                      Thanks for the help!!
                      Tony

                      Comment


                        #12
                        Re: Long calculated field in a grid causing Alpha to slow, then lock up

                        Tony,

                        Below is a query that assumes that the query has access to a field named FlightNum that has text values 'C','1','2','3','4','5'... I'm not sure what is in your Flight field. Is that the single character value, or the ordinal description?

                        Test out this query in SSMS and let me know if it is working.

                        Code:
                        SELECT V_Teams.Team_ID
                        	,V_Teams.Tourn_ID
                        	,V_Teams.SunAMPM
                        	,V_Teams.FlightNum
                        	,IF(V_Teams.FlightNum='C','Championship',
                        	CHOOSE(CAST(V_Teams.FlightNum AS INTEGER), 'First','Second','Third','Fourth','Fifth','Sixth','Seventh','Eighth')) as Flight	
                        	,V_Teams.NAMES
                        	,V_Teams.SatScore
                        	,V_Teams.SunHole
                        	,Tournaments.Active
                        FROM V_Teams INNER JOIN Tournaments ON V_Teams.Tourn_ID = Tournaments.Tourn_ID
                        WHERE active = 'yes'
                        ORDER BY IF(V_Teams.FlightNum='C',0,CAST(V_Teams.FlightNum AS INTEGER))
                        	,V_Teams.SatScore
                        If you PM me with your phone number or Skype name I can talk it over with you.
                        Last edited by Ben S.; 07-23-2018, 10:24 AM. Reason: removed Skype link reference because it doesn't work.

                        Comment


                          #13
                          Re: Long calculated field in a grid causing Alpha to slow, then lock up

                          I will PM you, thanks!

                          Comment

                          Working...
                          X