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

Conditional Field status

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

    Conditional Field status

    In my logon script I would like to lookup an employee's supervisor status as they log in and set a global variable based on its value.

    The supervisor status is a logical field called "Empissuper".

    The global variable I want to set is (gvIsSuper) and I would like to set the variables value equal to T or F.

    I want to base the lookup on their user id (gvuser)

    I perform lookups like this already on character fields although could use some assistance on how to do this with a logical field.

    Below is an example of where I lookup a character field and set a global variable equal to the value in the character field.

    gvEmpid = lookupc("F", gvuser, "alltrim(Empid)", "emp","_Emplognid")

    What is the best way to do this for a logical field?

    In the end I would like to make various fields on a form "Read Only" if gvIsSuper=F and make it editable if gvIsSuper=T

    I will be using the variable gvIsSuper for other things so I do want to write their supervisor status to a variable.

    #2
    Re: Conditional Field status

    Hi Scott,

    First of all as you are comfortable with lookupc(), how about using LOOKUPL()?

    The other method is to test which group the user is in and set the fields accordingly. To test the group the logged user is in, you would use is_one_of(user_groups()).
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

    Comment


      #3
      Re: Conditional Field status

      I am not using A5 security, it is my own. I tried using Lookupl but was having trouble with the syntax, can you provide me an example using the fields I provided earlier in the post?

      Comment


        #4
        Re: Conditional Field status

        scott,

        I also do not use alpha security. Made my own before they had one.

        I do this at log on with a couple of tables. There are several fields in these tables I need into variables until the app is closed. Most are dependent on the user. I will share how I do it and see if it helps you?

        The variables used below are already defined as global.

        Code:
        t=table.open("employ",file_ro_shared) 
        query.filter="username="+quote(trim(scode))
        query.order="" 
        query.options="T" 
        ix=t.query_create() 
         if ix.records_get()=0 then 
          a5.close() 
         end if 
        username=t.username 
        salesman=t.salesname 
        cellphone = t.cellphone 
        password = t.password 
        usernow = t.usernow
        permissions = t.permissions
        userlot = t.lot
        gotoileads = t.gotoileads
        gotosales = t.gotosales
        gotoother = t.gotoother
        gotoreports = t.gotoreports
        gotocsi = t.gotocsi
        buycar = t.buycar
        gotoslsschedule = t.gotoslsschedule
        gotoslslabels = t.gotoslslabels
        setupemail = t.setupemail
        seedealnumbers = t.seedealnumbers
        reshadow = t.reshadow
        gotocomp = t.gotocomp
        cleantbls = t.cleantbls
        gotoinv=t.gotoinv
        editletters=t.Editletters
        gotoslspeople = t.gotoslspeople
        editownpassword = t.editownpassword
        editownuserinfo=t.editownuserinfo
        seeallslspeople=t.seeallslspeople
        editpermiss=t.editpermiss
        gotovendors=t.gotovendors
        gotobanks=t.gotobanks
        gotoagents=t.gotoagents
        gotorebates=t.gotorebates
        deletesales=t.deletesales
        makebackup=t.makebackup
        editcompinfo=t.editcompinfo
        advertisers=t.advertisers
        compbat = t.bat
        comptire = t.tire
        complemon = t.lemon
        comptags = t.transfer
        comppmtterm = t.term 
        comptermtype = t.termtype
        compapr = t.apr
        compnewwheels = t.newwheels  
        compantitheft = t.antitheft
        t.close()
        Dave Mason
        [email protected]
        Skype is dave.mason46

        Comment


          #5
          Re: Conditional Field status

          Keith, Below is what I tried with the Lookupl and did not work.......

          gvIsSupervisor = lookupl("F", gvuser, iif(Empissuper()="T","T","F"), "emp","_Emplognid")

          Comment


            #6
            Re: Conditional Field status

            Code:
            gvIsSupervisor = lookupl("F", gvuser, "Empissuper", "emp","_Emplognid")
            Tim Kiebert
            Eagle Creek Citrus
            A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

            Comment


              #7
              Re: Conditional Field status

              Tim's answer is correct. Just to add a bit more explanation...

              LookupL() returns only logical values - .T. or .F.

              "T" and "F" are character values - which can't be compared to the logical field value and can't be returned by LookupL().

              Since the field is already a logical field, just return the field value.

              Comment


                #8
                Re: Conditional Field status

                What "type" should the Global variable be? It is currently Dim'ed as C but does not return the correct value.

                DIM GLOBAL gvIsSupervisor as C
                gvIsSupervisor = lookupl("F", gvuser, "Empissuper", "emp","_Emplognid")

                I have three test emps with T as their value in the Empissuper field and three with F but the returned value is always T and I am not sure why? Any ideas?

                Comment


                  #9
                  Re: Conditional Field status

                  Now you've got me worried. Are you sure it's a logical field?

                  If it is truly a logical field, all references should be logical. If it's character field, everything should be a character. When looking at the default browse, a logical field will show only T or F (without any dots) but it's still a logical field and the result in xbasic will be .T. or .F. and LookupL() would be the correct lookup function to use.

                  Why am I worried? Because I believe I ran into a situation where the logical value of a character field with anything in it was always True. However, I could be completely wrong as I can't figure out how to duplicate the situation right now.

                  Comment


                    #10
                    Re: Conditional Field status

                    Attached are a couple of screen shots that may help reassure you it is setup as we have detailed out. Let me know if you see anything "odd".

                    Comment


                      #11
                      Re: Conditional Field status

                      you need to make the variable a logical variable or else

                      if lookupl(xxx)=.t.
                      var->="T"
                      else
                      var->="F"
                      end if
                      Cole Custom Programming - Terrell, Texas
                      972 524 8714
                      [email protected]

                      ____________________
                      "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                      Comment


                        #12
                        Re: Conditional Field status

                        Martin, I assume that would take the return value of the Lookup and force the return of a character (T or F).

                        It looks like I can set the DIM to type L and it should be able to hold the logical value that is returned. Unfortunately when I try it I receive an error when running the script.

                        Here is what I tried to do....

                        DIM GLOBAL gvIsSupervisor as L

                        gvIsSupervisor = LOOKUPL("F",gvuser,"Empissuper","emp","_Emplognid")

                        Have any ideas?

                        Comment


                          #13
                          Re: Conditional Field status

                          close the app and then reopen it and try again - most likely it was already defined and the new dim bombed as it was already dimmed as c
                          Cole Custom Programming - Terrell, Texas
                          972 524 8714
                          [email protected]

                          ____________________
                          "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                          Comment


                            #14
                            Re: Conditional Field status

                            Perfect, That was it. I closed Alpha and relaunched and now everything is working as exspected but I still need to figure out the second part of my original question........

                            In the end I would like to make various fields on a form "Read Only" if gvIsSuper=F and make it editable if gvIsSuper=T

                            Ideas anyone?

                            Comment


                              #15
                              Re: Conditional Field status

                              in the form's onfetch event

                              Code:
                              if var->xxx=.t.
                                   objectname.field.readonly=.t.
                              else
                                   objectname.field.readonly=.f.
                              end if
                              Cole Custom Programming - Terrell, Texas
                              972 524 8714
                              [email protected]

                              ____________________
                              "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                              Comment

                              Working...
                              X