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

Late to the party.... Session questions

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

    Late to the party.... Session questions

    Hi everyone, I just upgraded to the newest version of Anywhere and have started to transition my old stuff.
    My biggest hurdle seems to be session variables. I use to use a ton of them that were all set on the first page after login how do I set the session.userid now?

    Code:
    <!doctype html>
    <html>
    <head>
    <%a5
    dim nEmid as n = 0
    
    session.__protected__clientSideDateFormat = "MM/dd/yyyy"
    session.noshift = "Has shift"
    nEmid = a5_convert_type(session.userid,"N")
    
    vTemp=<<%a%
    SELECT active_status FROM employees WHERE em_id = {nEmid}
    %a%
    dim GSVSelect as c
    dim gsv as SQL::connection
    dim grs as SQL::ResultSet
    gsv.open("::name::test")
    GSVSelect=evaluate_string(vTemp)
    gsv.Execute(GSVSelect)
    grs=gsv.ResultSet
    vStatus=grs.data("active_status")
    if vStatus=.f.
    
    end if
    
    vgst=".05"
    vhst=".13"
    vpst=".08"
    session.taxes=vgst+"|"+vpst+"|"+vhst
    
    dim GSVSelect as c
    vTemp=<<%a%
    SELECT * FROM employees WHERE em_id = {nEmid}
    %a%
    GSVSelect=evaluate_string(vTemp)
    gsv.Execute(GSVSelect)
    grs=gsv.ResultSet
    session.emp_email=grs.data("cwcemail")
    session.fullname=grs.data("em_name")
    session.storename=grs.data("store")
    session.badgename=grs.data("badge_name")
    session.position=grs.data("em_position")
    session.fdapi=grs.data("freshdesk_api")
    session.ov_id=grs.data("oneview_id")
    session.ov_dc=grs.data("oneview_dealer_code")
    session.ov_pw=grs.data("oneview_password")
    session.territory = grs.data("territory")
    session.certx = ""
    session.invnum as n =0
    
    dim gemailvSelect as c
    dim gers as SQL::ResultSet
    gemailvSelect="SELECT mgr_email, store_email, type, storeid,dealercode,distmgremail FROM stores WHERE store_name = '"+session.storename+"'"
    gsv.Execute(gemailvSelect)
    gers=gsv.ResultSet
    session.mgremail=gers.data("mgr_email")
    session.storemail=gers.data("store_email")
    session.storeid=gers.data("storeid")
    session.storetype=gers.data("type")
    session.dealercode=gers.data("dealercode")
    session.distmgremail=gers.data("distmgremail")
    gsv.close()
    end if
    
    
    session.ipaddress = Request.REMOTE_ADDR
    sleep(.2)
    
    dim conn as SQL::Connection
    dim rset as SQL::ResultSet
    dim NumberFound as n = 0
    dim SqlInsert as C = ""
    dim Args as SQL::Arguments
    dim nfound as n =0
    session.test="got_to_first"
    conn.open("::name::cwc")
    'this is where we check to see if they are a manager or higher at a store
    'need to check the login to see if its the first login of the day
    'if it is then include the todolist page
    
    if session.position="Manager" .or. session.userid = "856" .or. session.userid ="891"
    session.test="got_to_second"
    dim vTemp12 as c = ""
    dim Sqllook as C = ""
    vTemp12=<<%a%
    SELECT count(userid) as kount12 FROM `login_log` WHERE `userid` = '{session.userid}' AND `created_date` = CURDATE()
    %a%
    Sqllook=evaluate_string(vTemp12)
    conn.Execute(Sqllook)
    rset=conn.ResultSet
    dim nfound12 as n = 0
    nfound12=rset.data("kount12")
    if nfound12=0 'include todolistpage
    a5w_include("todolist.a5w")
    end if
    end if
    'this is wher we check to see if they are a sales rep.
    session.test="got_to_second"
    dim vTemp12 as c = ""
    dim Sqllook as C = ""
    vTemp12=<<%a%
    SELECT count(userid) as kount12 FROM `login_log` WHERE `userid` = '{session.userid}' AND `created_date` = CURDATE()
    %a%
    Sqllook=evaluate_string(vTemp12)
    conn.Execute(Sqllook)
    rset=conn.ResultSet
    dim nfound12 as n = 0
    nfound12=rset.data("kount12")
    if nfound12=0 'include todolistpage
    a5w_include("todolist_employees.a5w")
    end if
    
    
    
    vTemp=<<%a%
    INSERT INTO login_log (userid, ip_address, created, server_ip,server_count,created_date) VALUES ('{session.userid}',
    '{session.ipaddress}', now(),'{ServerSetting.BindIP}', {Server.SessionCount}, curdate())
    %a%
    SqlInsert=evaluate_string(vTemp)
    conn.Execute(SqlInsert)
    args.add("ArgEmp",session.__protected__userid)
    args.add("Argip",session.ipaddress)
    
    
    '**************check to see if today is a scheduled day for this employee in the time_card table
    
    dim sqltimecard as c = ""
    dim rsettime as SQL::ResultSet
    dim timefound as n =0
    dim timelate as n =0
    dim Argstime as SQL::Arguments
    dim updatebreaks as c = ""
    session.login_type = "Started"
    sqltimecard="SELECT count(emp_num) as time_count FROM time_card WHERE emp_num=:ArgEmp AND created =curdate() and logged_in is null"
    conn.Execute(sqltimecard,Args)
    rsettime=conn.ResultSet
    timefound=rsettime.data("time_count")
    if timefound = 1
    session.login_type = "first"
    dim upd_timecard as c =""
    Upd_timecard="UPDATE time_card SET logged_in=now() WHERE emp_num=:ArgEmp AND created =curdate()"
    conn.Execute(Upd_timecard,Args)
    sleep(.5)
    
    
    dim late_count as n = 0
    sqltimecard="Select count(loggedin_diff) as late_count from timecard_start_diff WHERE emp_num=:ArgEmp AND created =curdate()"
    conn.Execute(sqltimecard,Args)
    rsettime=conn.ResultSet
    late_count=rsettime.data("late_count")
    sleep(.5)
    if late_count >0
    
    sqltimecard="Select loggedin_diff from timecard_start_diff WHERE emp_num=:ArgEmp AND created =curdate()"
    conn.Execute(sqltimecard,Args)
    rsettime=conn.ResultSet
    timelate=rsettime.data("loggedin_diff")
    '******************if they are more than 5 min late then send an email to the employee and manager
    if timelate >5
    
    dim message as p
    message.to=session.emp_email
    message.cc=session.mgremail
    message.from="[email protected]"
    message.subject = session.fullname+" Late login"
    message.message = "You have logged into your shift "+timelate+" minutes late. Your manager has been copied on this email"
    email_send2(message,"wasemail",.t.,.f.)
    
    Upd_timecard="UPDATE time_card SET early_late ='L', mgr_comment='Late login', start_time =now() WHERE emp_num=:ArgEmp AND created =curdate()"
    conn.Execute(Upd_timecard,Args)
    
    end if
    
    end if
    end if
    
    '***************check to see if they have an open break and log them back in to close out the break*************
    dim sqlbreaks as c = ""
    dim vbcount as n = 0
    dim vbreakfound as n = 0
    sqlbreaks="SELECT count(emp_num) as vbcount FROM break_view WHERE emp_num=:ArgEmp AND created = curdate() AND backfrombreak is null"
    conn.Execute(sqlbreaks,Args)
    rsettime=conn.ResultSet
    vbreakfound=rsettime.data("vbcount")
    if vbreakfound >0
    dim upd_breaks as c =""
    upd_breaks="UPDATE break_view SET backfrombreak=now(), ip_address_return=:Argip WHERE emp_num=:ArgEmp AND created =curdate()"
    conn.Execute(Upd_breaks,Args)
    session.login_type = "Break"
    end if
    '*********************end break check and update***********
    
    session.pic_login = ""
    session.pic_logout = ""
    session.pic_return = ""
    session.mth = cmonth(date())
    session.yr = cyear(date())
    
    
    
    
    
    
    
    
    
    '****************************************end of schedule check
    
    
    
    EndIt:
    gsv.close()
    '********Addition of active employee lookup********
    '
    
    dim session.activestaff as C=""
    dim session.mgrlist as C=""
    if session.position <> "Sales Consultant"
    'session.activeemp = ""
    dim cnx as SQL::Connection
    dim args as SQL::Arguments
    dim crs as SQL::ResultSet
    dim SqlSelect as C = ""
    dim SqlSelectMan as c = ""
    dim NumberFoundM as n = 0
    dim NumberFound as n = 0
    dim kount as n =0
    dim kount1 as n =0
    dim mgrlist as c =""
    args.Add("Argmanager","Manager")
    SqlSelectman="SELECT count(em_id) as kount1 FROM Employees WHERE active_status = 1 AND em_position=:argmanager and em_id NOT IN ('53', '90', '174', '120', '316', '960')"
    cnx.open("::name::cwc")
    cnx.execute(SqlSelectman,args)
    crs=cnx.ResultSet
    NumberFoundM=crs.data("kount1")
    if NumberFoundM >1
    SqlSelectman="SELECT em_id FROM Employees WHERE active_status = 1 AND em_position=:argmanager and em_id NOT IN ('53', '90', '174', '120', '316', '960')"
    cnx.execute(SqlSelectman,args)
    crs=cnx.ResultSet
    while crs.nextrow()
    mgrlist =mgrlist +","+crs.data("em_id")
    end while
    session.mgrlist=mgrlist
    end if
    
    args.Add("Argstoreid",session.storename)
    SqlSelect="SELECT count(em_id) as kount FROM Employees WHERE active_status = 1 AND store=:Argstoreid"
    
    cnx.execute(SqlSelect,args)
    crs=cnx.ResultSet
    NumberFound=crs.data("kount")
    
    if NumberFound >1
    dim activestaff as c = ""
    SqlSelect="SELECT em_id FROM Employees WHERE active_status = 1 AND store=:Argstoreid"
    cnx.execute(SqlSelect,args)
    crs=cnx.ResultSet
    while crs.nextrow()
    activestaff =activestaff +","+crs.data("em_id")
    end while
    session.activestaff=activestaff
    end if
    cnx.close()
    
    end if
    
    'check and see if employee is logged into the proper store.
    
    if session.position = "Sales Consultant"
    dim conn as SQL::Connection
    dim rsettime as SQL::ResultSet
    dim Args as SQL::Arguments
    dim sqltimecard as c = ""
    dim timefound as n = 0
    nEmid2 = convert_type(session.__protected__userid,"N")
    
    conn.open("::name::cwc")
    Args.Add("ArgEmp2",nEmid2)
    Args.Add("Argstoreid2",session.storeid)
    
    sqltimecard="SELECT count(emp_num) as time_count FROM time_card WHERE emp_num=:ArgEmp2 AND created =curdate() AND storeid=:Argstoreid2"
    conn.Execute(sqltimecard,Args)
    rsettime=conn.ResultSet
    timefound=rsettime.data("time_count")
    if timefound = 1
    session.noshift = "Has shift"
    else
    session.noshift = "No Shift"
    end if
    end if
    conn.Close()
    session.logintime = a5_timestamp()
    
    outofhere:
    '********Finish lookup***********
    %>
    
    <%a5
    
    Delete tmpl_CWC_MASTER
    DIM tmpl_CWC_MASTER as P
    tmpl_CWC_MASTER = a5w_load_component("Cwc_master") ''SYSTEM GENERATED COMMENT - PLEASE DO NOT REMOVE (LOAD:Cwc_master)
    
    'Override settings start -----------------------------------------
    with tmpl_CWC_MASTER
    .alias = "CWC_MASTER"
    _dialogFilename = "Cwc_master"
    end with
    'Override settings end -----------------------------------------
    
    delete x_CWC_MASTER
    dim x_CWC_MASTER as p
    x_CWC_MASTER = a5w_run_Component(tmpl_CWC_MASTER) 'SYSTEM GENERATED COMMENT - PLEASE DO NOT REMOVE (RUN:tmpl) (EDIT:Cwc_master)
    
    ?x_CWC_MASTER.Output.Head.JavaScript
    ?x_CWC_MASTER.Output.Head.CSS_Link
    
    ?x_CWC_MASTER.Output.Head.Title
    %>
    
    
    <!--Alpha Five Temporary Code Start - Will be automatically removed when page is published -->
    <!--CSS for tmpl -->
    <link rel="stylesheet" type="text/css" href="file:///C:/Program Files (x86)/a5V12/css/cwcblue/style.css">
    <!--Alpha Five Temporary Code End -->
    
    
    <!--Alpha Five Temporary Code Start - Will be automatically removed when page is published -->
    <!--CSS for tmpl -->
    <link rel="stylesheet" type="text/css" href="file:///C:/Program Files (x86)/a5V12/css/iOS/style.css">
    <!--Alpha Five Temporary Code End -->
    
    
    <!--Alpha Five Temporary Code Start - Will be automatically removed when page is published -->
    <!--CSS for tmpl -->
    <link rel="stylesheet" type="text/css" href="file:///C:/Program Files (x86)/a5V12/css/iOS/style.css">
    <!--Alpha Five Temporary Code End -->
    
    
    <meta name="generator" content="Alpha Anywhere HTML Editor Version 12 Build 2446-4365">
    <!-- must use in order to make XP Themes render -->
    <meta HTTP-EQUIV="MSThemeCompatible" content="Yes" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    
    <title></title>
    </head>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    <body class="cwcbluePage">
    
    
    
    <p align=center>
    <%a5 ?x_CWC_MASTER.Output.Body.Dialog2_HTML %></p>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    </body></html>
    Chad Brown

    #2
    Alpha has built this in. https://documentation.alphasoftware....nformation.xml

    Comment


      #3
      Saw that but was trying to not reinvent the wheel.
      this works a5ws_getcurrentuser()
      set the session.userid = a5ws_getcurrentuser()

      Thanks
      Chad Brown

      Comment

      Working...
      X