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

Invalid Argument sent to A_RULE.API

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

    Invalid Argument sent to A_RULE.API

    Hi, I've never gotten this message before so I'm wondering what's wrong with my code. The code is as follows:
    home.value=CASE(checkbox_2.value=.T.,"X",checkbox_2.value=.F.,"")
    What I'm trying to accomplish is to place an "X" in the "home" field if checkbox_2 is a true evaluation. The "home" field is a character field which accepts one character. It looks ok to me and the syntax checks ok but it certainly doesn't like this much. This code is triggered on the "cansave" event on a form. Any ideas would be appreciated. I'm certainly not the foremost in writing code. I only use this forum when I'm really stumped. Thanks in advance to all who reply.

    Scott

    #2
    Re: Invalid Argument sent to A_RULE.API

    Is checkbox_2 a logical field in your table? If not tell us about it, and supply examples of the values stored there.

    Comment


      #3
      Re: Invalid Argument sent to A_RULE.API

      Hi Tom, yes checkbox_2 is a logical value. Home.value is a character field. In a previous post to this I was having trouble with my code trying to use checkbox_2 to post an address in another field if it was true. Stan helped with the proper way to write the code to make it work. With his help, I was able to make it work successfully. The post was just before this one in this forum. I was trying to use the same type of formatting for this one also. I'm just not sure why I'm getting this error message. Basically if checkbox_2 is true I want an "X" placed in the "home" field and if it is false, to leave the "home" field blank. In the second half of the equation I also tried "checkbox_2.value=.F.,ISBLANK("home") and got the same result. I have made sure I'm using object names with the exception of the referral to the "home" field after the ISBLANK function. Home is the object and field name for that field. Thanks for the reply.

      Comment


        #4
        Re: Invalid Argument sent to A_RULE.API

        I reconstructed your scenario as best I could in terms of field names and the code works in V11, not that that is of any help to you. Can you attach a sample of the table with the support files here?

        Just for testing you could also write that code

        home.value=CASE(checkbox_2.value,"X",.T.,"")
        or since there are only two possibilities
        home.value=if(checkbox_2.value,"X","")
        Last edited by Stan Mathews; 05-09-2013, 09:51 AM.
        There can be only one.

        Comment


          #5
          Re: Invalid Argument sent to A_RULE.API

          If it is a field rule violation - you haven't set home with a calculated field rule have you?
          Robin

          Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

          Comment


            #6
            Re: Invalid Argument sent to A_RULE.API

            Hi guys, home does not have a field rule value. It is simply just a one character field. I'll try the other code and see if that works. Unfortunately I can't attach the corresponding tables as the set involved contains many tables. We also have confidentiality issues with the data that's in all the tables. These are all county child support records and per our contract are not allowed to release them. I'll do the best I can to answer any questions I can. If there were a field rule attached would that then violate the field rules? Thanks again guys. I have to be gone for a few hours but will return to the database this afternoon. Thanks again....

            Comment


              #7
              Re: Invalid Argument sent to A_RULE.API

              If the code were put in the change event for checkbox_2, then toggling the checkbox would set or clear the home field. Add a parent.commit() to the script and home.value should refresh.

              if this.value = .t. then
              home.value = "X"
              else
              home.value = ""
              end if
              parent.commit() ' or use home.refresh()

              Other than that, you haven't said if the CanSave event for the form is doing anything else. Your field rule violation may be caused by something else is my thought.
              Robin

              Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

              Comment


                #8
                Re: Invalid Argument sent to A_RULE.API

                If I were doing this in the CanSaveRecord event of the table field rules, I'd do something like this:

                Code:
                t = table.current()
                if checkbox_2 then
                     t.home = "X"
                else
                     t.home = ""
                end if
                If I were doing this in the CanSave event of the form, and
                all fields were present in objects on the form, and
                all objects were named the same as the fields they display, then
                I do it this way:

                Code:
                If this:checkbox_2.value = .t. then
                    this:home.value = "X"
                else
                    this:home.value = ""
                end if
                Different syntax would be required if any of the fields are displayed inside a browse control.

                Comment


                  #9
                  Re: Invalid Argument sent to A_RULE.API

                  Thanks for the ideas guys they are truly appreciated. Actually there are some other things happening in the can save event however everything has worked fine until I added the code I showed you. I went through and placed an apostophe before each line and then ran everything releasing one line at a time. no hang ups until my latest code that we're discussing. None of the fields are displayed within a browse control. I just got home so I'll be trying some of these suggestions and I'll let you guys know what happens. Thanks again for the replies.

                  Comment


                    #10
                    Re: Invalid Argument sent to A_RULE.API

                    Hi guys, I tried all the above combinations including trying the code in the candepart event on the "home" field and I am still getting the same error message when I save the record. Maybe it's a bug in this version of Alpha5. My whole intent is so my employees have to manually enter as little info as possible, thus lowering the error possibility. I think at this point I'm going to just have them enter the "X" in the appropriate field manually and call it good. I need to go onto other projects within our database. Thanks to all for the ideas and code to try. Sometimes you just can't win for losing...lol.

                    Comment


                      #11
                      Re: Invalid Argument sent to A_RULE.API

                      Update: I found that even though that error message comes up, it still executes the code and once it's saved it's there permanently. Weird. I would have thought because of the error, it would not execute the code. This is just FYI. Thanks again to all.

                      Comment


                        #12
                        Re: Invalid Argument sent to A_RULE.API

                        Hi Scott,
                        Did you try my idea of having the checkbox change event put in your 'X' or remove it? That's seems more intuitive to me.
                        Robin

                        Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                        Comment


                          #13
                          Re: Invalid Argument sent to A_RULE.API

                          Hi Robin, my apologies for not getting back for so long. I've been busy with other changes and haven't been on the forum. Anyway, I did try your idea but it didnt work. Not sure why. I double checked the code and all was entered correctly, it just didn't do anything. I'm still running into the same problem with some other forms and it's frustrating. I can't figure out what makes any of these codes an invalid argument. I'm going to research the forum more and see if there is anything else similar, that I haven't posted....lol.

                          Comment

                          Working...
                          X