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

UDF Parameters lookup

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

    UDF Parameters lookup

    Not sure if I dreamed this up, but I think there was a way to make it possible to lookup certain parameters (e.g. sets, tables, indices etc.) in a UDF.

    Is there?

    #2
    Re: UDF Parameters lookup

    G, I'm not understanding the question. I suppose you're not asking about any of the lookup() functions, right? The parameters passed to a function are available to the function itself, of course, so you must not be talking about that either, right? So, what's the context in which you might want to "lookup certain parameters" ?

    Comment


      #3
      Re: UDF Parameters lookup

      Yes, you can do this. I've done it, it's buried in the help file someplace that I can't find right now, and Ira knows how to do it.

      Tom - he's looking to provide some autocomplete help with the parameters in a UDF. For instance, if a tablename is selected, you can provide some dropdown-type/autocomplete select list of the indexes for that table, for instance.

      Too busy to complete my search for this today and give you the answer, but I know you can do it.

      If this is still unanswered tonight (I'm teaching all day) I'll look some more. I'd like more of my UDFs to have this feature and I need to get in better practice of using it.
      -Steve
      sigpic

      Comment


        #4
        Re: UDF Parameters lookup

        Thanks Steve..
        I know it's there, in fact I did it before and for the life of me can't remeber where I found it in the help file nor willing to spend a whole lot of time looking right now.

        Tom:
        Steve explained it better than I did.

        Comment


          #5
          Re: UDF Parameters lookup

          I think I found it:
          http://support.alphasoftware.com/alp...e/function.htm

          Comment


            #6
            Re: UDF Parameters lookup

            Hi Steve,

            Originally posted by Steve Workings View Post
            Yes, you can do this. I've done it, it's buried in the help file someplace that I can't find right now, and Ira knows how to do it.
            Unfortunately, it's undocumented and UNSUPPORTED! It is a real kludge and doesn't allow for different functions using the exact same parameter name (e.g. TableName) to have different help. On the other hand, if another system function already has parameter help the way you like it, then just name your parameter the same as that function's.

            I had suggested to Selwyn back a couple of years ago to allow user supplied function help by specifying a line something like near the top of the code something like this

            Code:
            'ParameterHelp:Parameter1Name:UsersParameter1FunctiontoPopupHelp(pointer_to_current_function_parameter_values)
            'ParameterHelp:Parameter2Name:UsersParameter2FunctiontoPopupHelp(pointer_to_current_function_parameter_values)
            Alternatively, you can try my method for parameter help/prompting. It doesn't help when coding, but does help when using it. That is, when the parameter has a leading space (for characters or blobs), or is a NULL_VALUE() or other type that is not supported, I pop up a dialog with selections for that parameter. For number fields that are not negative, I often use a negative value to force the prompt, converting the absolute value as the default).

            This makes it very easy to use the functions in the interactive window or when you want it to prompt you. The default value for the dialog is always the substr(parameter,2) value(s), or abs(parameter) for numeric types.

            Most of my released functions do this, and I have updated just about all of my code to invoke this through a simple standardized XDialog function I created. Thus, with 1 line of code and some help text passed to it, I get a very useful menu selection
            Regards,

            Ira J. Perlow
            Computer Systems Design


            CSDA A5 Products
            New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
            CSDA Barcode Functions

            CSDA Code Utility
            CSDA Screen Capture


            Comment


              #7
              Re: UDF Parameters lookup

              Actually, you reminded me Ira, though mostly in passing, how to do the simplest of this.

              For anyone who cares, build this function:

              Code:
              FUNCTION TestPrompt AS f (tablename AS C )
              	msgbox("tablename is", tablename)
              END FUNCTION
              Then, when you use it, because you specified tablename, you get the "usual" behavior from Alpha to find a table name.

              You can look at any function in Alpha, such as lookupc() where tablename is one of the parameters, to see how this would perform.

              Here's another example:

              Code:
              FUNCTION SelectLayout AS F (layoutname AS C )
              	msgbox("Selected Layout is", layoutname)
              END FUNCTION
              Here, the use of the layout parameter behaves the same way it does when, for example, you're writing the report.preview() instruction.

              This doesn't completely accomplish what Ira is suggesting or give us the kind of flexibility that would be nice to have, but does offer a bit of standard help to UDF users.
              -Steve
              sigpic

              Comment


                #8
                Re: UDF Parameters lookup

                Ira and all,
                By coincidence I have been doing just what is being asked for here in a UDF I am creating.

                A couple of things. As Ira indicated, if you use the same argument name as an existing Alpha function, your UDF will utilize the same feature as Alpha's. You can be more descriptive also in that say the Alpha argument is "tablename". If you name your argument "First_tablename", "Last_tablename" or whatever prefix you want with an underscore in front it will use the Alpha argument's feature, in this case, of course, a crlf list of all the tables in the database.

                Also with the function bubblehelp Selwyn posted on the board and which I had also posted more recently, you can create you own with the addin.function_argument_help(). I recently added 2 more addins to the list--ui_get_filter() and ui_get_order(). I am having a bit of problem being able to pass some variables to this UDF in order to have different tables/sets appear....this particular UDF will have the capability of passing one set and 3 tables along with each of the table's fields as dropdown lists. Will that is if I can get it to readily accept my variables for the various tables which is needed to then bring up the specific table's fields.

                :)

                I will have to check out that help page that G posted as well--seems to be on the same sort of path as the addin argument.

                Cal Locklin helped out as far as making the help under the function appear--the trick is to create an AEX and import it to your Library (database specific) or add it to the Alpha install directory folder called "addins installed".

                Any takers on how to pass the various table names (variables) to the fieldname arguments so to have them give the corresponding table's fieldnames instead of just the first tablename argument?? :)


                EDIT___Ira, Could you explain just a bit more regarding your work-around for this--may just work a bit better maybe...or used in conjunction with what I am currently doing.
                Last edited by MikeC; 10-03-2008, 01:42 AM.
                Mike
                __________________________________________
                It is only when we forget all our learning that we begin to know.
                It's not what you look at that matters, it's what you see.
                Henry David Thoreau
                __________________________________________



                Comment


                  #9
                  Re: UDF Parameters lookup

                  Got this a while ago, can't remember where from, hope it helps

                  Comment


                    #10
                    Re: UDF Parameters lookup

                    Originally posted by MikeC View Post
                    You can be more descriptive also in that say the Alpha argument is "tablename". If you name your argument "First_tablename", "Last_tablename" or whatever prefix you want with an underscore in front it will use the Alpha argument's feature, in this case, of course, a crlf list of all the tables in the database.
                    Nice find. However, it could be annoying if that was not the intended parameter prompt.

                    Originally posted by MikeC View Post
                    Also with the function bubblehelp Selwyn posted on the board and which I had also posted more recently, you can create you own with the addin.function_argument_help(). I recently added 2 more addins to the list--ui_get_filter() and ui_get_order(). I am having a bit of problem being able to pass some variables to this UDF in order to have different tables/sets appear....this particular UDF will have the capability of passing one set and 3 tables along with each of the table's fields as dropdown lists. Will that is if I can get it to readily accept my variables for the various tables which is needed to then bring up the specific table's fields.

                    :)

                    I will have to check out that help page that G posted as well--seems to be on the same sort of path as the addin argument.

                    Cal Locklin helped out as far as making the help under the function appear--the trick is to create an AEX and import it to your Library (database specific) or add it to the Alpha install directory folder called "addins installed".

                    Any takers on how to pass the various table names (variables) to the fieldname arguments so to have them give the corresponding table's fieldnames instead of just the first tablename argument?? :)
                    You can create your own code to prompt for the parameter's help, and then use the special parameters below in the code that calls it.
                    %lastvalue%
                    %tablename%
                    %thisobject%
                    %system_mode%
                    %functionname%
                    I believe they are current values from other parameter fields you have set elsewhere in the parameter line.

                    Originally posted by MikeC View Post
                    Ira, Could you explain just a bit more regarding your work-around for this--may just work a bit better maybe
                    Take a look at this sample code. There is more that I do, but this is the basic methodology.
                    Code:
                    'Date Created: 03-Oct-2008 08:54:53 AM
                    'Last Updated: 03-Oct-2008 09:01:50 AM
                    'Created By  : Ira J. Perlow
                    'Updated By  : Ira J. Perlow
                    FUNCTION FunctionParameterPrompts AS C (Character_Parameter="" as C, Numeric_Parameter=0 as N)
                    'DESCRIPTION: This is the description popup line for FunctionParameterPrompts
                    ' You may have to restart Alpha Five for the above to appear or to show current changes
                    
                    
                    
                    '=========================================================================
                    ' Created by Computer Systems Design & Associates
                    ' Created October 3, 2008
                    ' http://www.csda1.com
                    '=========================================================================
                    ' Sample inteactive usages
                    '    ?FunctionParameterPrompts(" GlobalFunctionName", -5)
                    '    ?FunctionParameterPrompts(" GlobalFunctionName", 4)
                    '    ?FunctionParameterPrompts("GlobalFunctionName", -6)
                    '    ?FunctionParameterPrompts("GlobalFunctionName", 7)
                    '    ?FunctionParameterPrompts("GlobalFunctionName")
                    '    ?FunctionParameterPrompts(" GlobalFunctionName")
                    '    ?FunctionParameterPrompts(" ")
                    '    ?FunctionParameterPrompts()
                    
                    ' Process input parameters
                    dim chrprm as c
                    IF Left(Character_Parameter,1)==" "
                        ' A leading space on this parameter means we want to prompt for value
                        chrprm=SUBSTR(Character_Parameter,2)    ' Default value to use without leading space
                    
                        ' Prompt for Character Parameter starting with 2nd character.
                        ' Normally a more extensive XDialog box
                        chrprm=ui_get_list2("List Dialog",chrprm,a5.Udf_Enum(2),1)
                        IF chrprm==""
                            EXIT FUNCTION    ' Exit if dialog box was cancelled
                        END IF    
                    ELSE IF Character_Parameter==""
                        ' Null parameter can be used to set default value, such as 
                        ' (DO ONLY 1 OF THE BELOW)
                            '------------------------------------------------------
                            ' set to XYZ, 
                            chrprm="xyz"
                            '------------------------------------------------------
                            ' leave as a null value ""
                            chrprm=""
                            '------------------------------------------------------
                            ' or do something special, e.g. display some help text
                            dim HelpText as c
                            HelpText=<<%text%
                    This is Help Text for the function FunctionParameterPrompts
                    To use this function......
                            %text%
                            ui_msg_box("FunctionParameterPrompts",HelpText,UI_OK)
                            EXIT FUNCTION
                            '------------------------------------------------------
                    ELSE
                        ' Otherwise use the parameter as given
                        chrprm=Character_Parameter
                    END IF
                    
                    dim numprm as n
                    IF Numeric_Parameter<0
                        ' A negative number on this parameter means we want to prompt for value
                        numprm=abs(Numeric_Parameter)    ' Default value to use
                    
                        ' Prompt for Numeric Parameter
                        ' Normally a more extensive XDialog box
                        choice=ui_get_number("Number Dialog","Enter number",ltrim(str(numprm)))
                        IF choice==""
                            EXIT FUNCTION    ' Exit if dialog box was cancelled
                        END IF    
                        numprm=val(choice)
                        ' we could loop back to dialog if value is not valid
                    ELSE IF Numeric_Parameter=0
                        ' Null parameter can be used to set default value, such as 
                            ' 5 
                            ' leave as 0 value
                            ' or do something special, e.g. display some help text
                        numprm=0
                    ELSE
                        ' Otherwise use the parameter as given
                        numprm=Numeric_Parameter
                    END IF
                    
                    ' Now do normal processing with modified values chrprm, numprm
                    FunctionParameterPrompts="Function Name: "+chrprm+", Number: "+LTRIM(STR(numprm))
                    
                    EXIT FUNCTION
                    
                    END FUNCTION
                    Regards,

                    Ira J. Perlow
                    Computer Systems Design


                    CSDA A5 Products
                    New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                    CSDA Barcode Functions

                    CSDA Code Utility
                    CSDA Screen Capture


                    Comment


                      #11
                      Re: UDF Parameters lookup

                      Thanks Ira,
                      You can create your own code to prompt for the parameter's help, and then use the special parameters below in the code that calls it.
                      %lastvalue%
                      %tablename%
                      %thisobject%
                      %system_mode%
                      %functionname%
                      I believe they are current values from other parameter fields you have set elsewhere in the parameter line.
                      I have used these, but perhaps I just didn't use them correctly in this case--I am so close to finishing this UDF as far as the "guts" of it that I'm getting a bit anxious I think! :)

                      I will take a closer look at your parameter scripting to see if I understand/can use it for the purpose I need it for.

                      Thanks again.



                      G--what Lance attached is what I was referring to that I had reposted from I think was a 2002 post by Selwyn. From that, the syntax of quite a bit of the features wanted to be incorporated into a UDF can be ascertained.
                      Mike
                      __________________________________________
                      It is only when we forget all our learning that we begin to know.
                      It's not what you look at that matters, it's what you see.
                      Henry David Thoreau
                      __________________________________________



                      Comment


                        #12
                        Re: UDF Parameters lookup

                        Thanks to all.

                        Comment


                          #13
                          Re: UDF Parameters lookup

                          Ira's reference to this function as a "kludge" may be an understatement. Has anyone been able to get it to work? If so, how?

                          I tried the following. When I create a function that uses "MyTest" as an argument then try to use the function, it tells me to "right click..." for the list but it won't show me the list to select from. I think "Q" should work but I tried at least "", "Q", "A", "=", "=Q", "=A", "QA", "=QA", "=AQ".

                          (I tried a few other things as well but won't go into all the gory details.)

                          text_list = <<%list%
                          asdf
                          qwer
                          zxcv
                          %list%

                          addin.function_argument_help( "MyTest", "Cals Test", text_list, "Q", "" )

                          Comment


                            #14
                            Re: UDF Parameters lookup

                            Cal,
                            absolutely have!! :)

                            Almost done with my UDF that will take most of the necessary parameters I need for a simple project. So far have 11 of 12 working--will work on the 12th tonight yet. I have it bring up:

                            1 list of sets
                            5 lists of independent tables
                            5 lists of fieldnames corresponding to the tables, 2 of which bring up the Filter Builder and the Order Builder.

                            The last item is to bring a crlf list of static names.

                            I'll get something together to post if you want---but may be difficult as I have gone through a whole bunch of renditions of the UDF to get it to work and have a ton of extraneous code in it that may just confuse (others and me!)
                            Mike
                            __________________________________________
                            It is only when we forget all our learning that we begin to know.
                            It's not what you look at that matters, it's what you see.
                            Henry David Thoreau
                            __________________________________________



                            Comment


                              #15
                              Re: UDF Parameters lookup

                              I would definitely be interested in seeing something that works. Or, if you can explain what is required, that would be even better yet.

                              Looking at the examples that Selwyn gave it seems like it should be pretty easy. I wouldn't be surprised to find that it's something simple I'm overlooking. It certainly wouldn't be the first time that happened.

                              EDIT: I figure it out. And, sure enough, it was something simple I overlooked. The string itself must be enclosed in quotes. This did the trick:
                              Code:
                              text_list = <<%list%
                              asdf
                              qwer
                              zxcv
                              %list%
                              
                              addin.function_argument_help( "MyTest", "Cals Test", [B][COLOR="Red"]"\""+[/COLOR][/B]text_list[B][COLOR="Red"]+"\""[/COLOR][/B], "Q", "" )
                              Last edited by CALocklin; 10-04-2008, 10:05 PM.

                              Comment

                              Working...
                              X