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

If Then Statement Help

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

    If Then Statement Help

    I'm new to xBasic, so I don't know much. I have this code that I want to run ONLY if the variable nFacilityID is not equal to 0. When I run the program though, the code gets executed anyway. I know for a fact that the variable is 0 because all the records in the db have a value of 0. What do I have wrong?

    If nFacilityID <> 0 then
    dim conn2 as sql::Connection
    flag = conn2.open("::Name::MedLook DB")

    dim argHosp as SQL::Arguments
    argHosp.Add("HospNumber", var->nFacilityID)

    dim sqlCommand as c
    sqlCommand = "SELECT id FROM DocIdent WHERE Id = :HospNumber"

    flag = conn2.Execute(sqlCommand,argHosp)

    dim hospRs as sql::ResultSet
    hospRs = conn2.ResultSet

    parentform:cmbFacility.value = convert_type(hospRs.data(1), "character")
    End If

    #2
    Re: If Then Statement Help

    You don't say where/how nFacilityID is populated with 0. Just to check, insert a debug in your script.

    debug(1)
    If nFacilityID <> 0 then
    dim conn2 as sql::Connection
    flag = conn2.open("::Name::MedLook DB")

    dim argHosp as SQL::Arguments
    argHosp.Add("HospNumber", var->nFacilityID)

    dim sqlCommand as c
    sqlCommand = "SELECT id FROM DocIdent WHERE Id = :HospNumber"

    flag = conn2.Execute(sqlCommand,argHosp)

    dim hospRs as sql::ResultSet
    hospRs = conn2.ResultSet

    parentform:cmbFacility.value = convert_type(hospRs.data(1), "character")
    End If

    the debugger will appear when the script executes. You can type in nFacilityID in the expression list at the bottom, hit enter, and you will see the present value.

    debug.png
    There can be only one.

    Comment


      #3
      Re: If Then Statement Help

      I set nFacilityID to the value of a column in a browse. It gets set whenever the user double clicks on the record in the browse. I just set the variable equal to the FacilityID in the selected record.
      Also, nFacilityId has the scope Layout.

      I tried the debug thing and nFacilityID does not have a value. So is the value NULL or ""?


      10-10-2012 11-16-32 AM.jpg

      Comment


        #4
        Re: If Then Statement Help

        I just set the variable equal to the FacilityID in the selected record.
        How and what scope?
        Your problem script may not be seeing the variable.
        There can be only one.

        Comment


          #5
          Re: If Then Statement Help

          You could just refer to the browse column value of the current selected record.

          If parentform:browse1:nFacilityID.value <> 0 then
          using the appropriate browseobjectname.
          There can be only one.

          Comment


            #6
            Re: If Then Statement Help

            I have all my scripts in different sections of In-Line xBasic, as you can see in the first picture. The top script populates the variables with the selected browse values, which you can see in the second picture.
            The only difference between populating the doctor and populating the facility is that the doctor has a value in the browse, and of course the variable names and sql statement. Populating the doctor works fine, the nDocId variable i use does not give me any trouble

            I tried using the parentform:Browse1:Facilityid.value in the If statement and it did not work either. I tried it as parentform:Browse1:Facilityid.value <> 0 and also parentform:Browse1:Facilityid.value <> "". neither of them worked.



            10-10-2012 11-58-43 AM.jpg

            10-10-2012 11-58-05 AM.jpg

            Comment


              #7
              Re: If Then Statement Help

              When I do something similar and I want to reference the variable elsewhere I dimension it as shared and I get

              DIM SHARED test AS c
              test = parentform:Browse1:Dir_ew.value

              I don't see the dim statement in your inline xbasic. Are they dimmed elsewhere?
              There can be only one.

              Comment


                #8
                Re: If Then Statement Help

                I just defined it from the menu bar Form->Variables. I redeclared it as a session variable and it has no effect.

                Is there a way to see if a numeric variable is empty?

                Comment


                  #9
                  Re: If Then Statement Help

                  Is there a way to see if a numeric variable is empty?
                  place - msgbox(str(nFacitityID,12,4)) - after the line the variable is populated and a message box will open and display the value.
                  Mike W
                  __________________________
                  "I rebel in at least small things to express to the world that I have not completely surrendered"

                  Comment


                    #10
                    Re: If Then Statement Help

                    The str(nFacilityID,12,4) did the job. Just did IF str(nFacilityID,12,4) <> "" then. Works good now. Thanks for the help!

                    Comment

                    Working...
                    X