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

User_name() Not working in Grid

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

    User_name() Not working in Grid

    The following syntax has been used: User_name() - Date() - Time()

    Corresponding Fields in a .dbf table have been defined as calculated and they include the above expressions.

    A grid which is based on the above table, in Preview is populated as expected by variable, user name, date and time records.

    Please help to understand why a record populated via internet explorer auto-populates date and time fields but NOT the user name. How can it be done?

    #2
    Re: User_name() Not working in Grid

    The User_name() can't get the current User because it's a desktop only function. The security for the desktop and web are completely different. Date and Time work because they're universal, in this case.

    I haven't tried this, but instead of User_Name() try A5WS_GETCURRENTUSER(). It's a guess... going to go try it now. If that doesn't work then you may have to load the user name yourself when a new record is activated.

    Comment


      #3
      Re: User_name() Not working in Grid

      Hi David,
      thanks for your repply. Not able to get to work, i now get the following error "Can't put to calculated field".
      I could do with an example in order to follow the second part of your repply.

      Cheers
      Tasos

      Comment


        #4
        Re: User_name() Not working in Grid

        Change your table username field from Calculated to User Entered.
        In your Grid, Client-Side Events, onRowFocus put something like this...
        Code:
        //place this Javascript in your code, and then reference the rowNum variable.
        var rowNum = {Grid.Object}._selectedRow;
        if (rowNum < 0)
        	{
        	{grid.Object}.ajaxCallback('G',rowNum,'GetCurrUser');
        	}
        This checks the row number and if it's less than zero - because the new row numbers are less than zero - then perform an Ajax Callback.

        In your Grid Properties, under Xbasic function declarations put this... it's just the last line... all the rest was created by Alpah5

        Code:
        function GetCurrUser as c (e as p)
        'This function will handle the Ajax callback. 
        'It must return a string of Javscript commands that will be executed in the Browser.	
        
        'The 'e' object contains all of the data that is submitted in the Ajax callback.
        
        'In addition, the 'e' object contains:
        'e._currentRowDataOld - (only if the grid is editable) - original value in the current row before field was edited. 
        '	examples:  e._currentRowDataOld.lastname, e._currentRowDataOld.firstname
        'e._currentRowDataNew as p - current field values in the current row.
        '	examples:	e._currentRowDataNew.lastname, e._currentRowDataNew.firstname
        'e._currentRowKeys - an array containing primary key field values for the current row
        '	example: If the primary key for the table that the grid is based on is 'Lastname' and 'Firstname', 
        '	e._currentRowKeys[1] will contain the value for 'Lastname' and e._currentRowKeys[2] will contain the value for 'Firstname'
        
        'e._gridCurrentFilter - current filter expression if the Grid has been filtered
        'e._gridCurrentOrder - current sort expression
        'e._gridCurentArgumentsXML - XML value of the sql::arguments object for any parameters in the e._gridCurrentFilter property.
        'Note: If the Grid is based on a SQL statement, to get the current SQL statement for the Grid (combining the SQL statement that the Grid is based on 
        'with the current Grid filter and order), you can use this Xbasic:
        'gridSQL = a5_sql_addfilterorder(e.tmpl.cs.sql,e._gridCurrentFilter,"",e._gridCurrentOrder)
        
        'e._isLinkedGrid - .t. if the Grid is a linked Grid (i.e. it has a parent Grid)
        'e._linkValues = linking value. Contains a CRLF delimited list of linking values in this format: fieldname|type|linkingValue
        
        'If the Grid checkbox column is turned on, the 'e' object will contain this properties
        'e.checkboxFilter - a filter command to select all of the checked rows
        'e.checkboxFilterArgumentXML - (for SQL Grids only) if the Grid is based on SQL tables, the e.checkboxFilter property will use arguments (e.g. customerID = :pkValue1)
        '							 - this property contains the XML version of the arguments
        'e.checkboxFilterArgumentsEncoded  - (for SQL Grids only) contains an encoded version of the e.checkboxFilterArgumentXML property that can be used in the .gridFilterSet() method.
        
        
        'In addition, the 'e' object contains:
        'e.tmpl - the Component definition
        'e.session - session variables
        'e.__si - state information that is stored in a hidden field in the component. 
        'e.rtc - holds runtime calculations that are performed when component is executing.
        
        'If you set certain properties in 'e._set' then the appropriate Javascript code will be automatically generated in the Ajax response
        'Examples:
        'e._set.lastname.value = "Smith"    --- will set the value of the 'Lastnme' field in the current row to "Smith"
        'e._set.lastname.style = "color: red;" --- will set the style attribute for the 'Lastname' field in the current row. 
        'e._set.lastname.className = "NewClassName" --- will set the ClassName attribute of the 'Lastname' field in the current row.
        'e._set.firstname.style.color = "red" --- will set the style.color attribute to 'Red' (preserving all other style attributes that had been set)
        'e._set.firstname.style.fontSize = "20pt" -- will set the style.fontSize attribute to '20pt' (preserving all other style attributes that had been set) (Important: the name of the style attribute is case-sensitive)
        
        'To set multiple values in a CheckBox or multi-select Dropdownbox control, set the .value property to a dot
        'variable that contains an array of values. The array must be called 'value'
        'Example:
        'Dim a as p   'a is an arbitrarily named dot variable
        'dim a.value[3] as c 'dim an array called 'value'
        'a.value[1] = "alpha"
        'a.value[2] = "beta"
        'a.value[3] = "gamma"
        'e._set.greekletters.value = a 
        
        'This will select 3 options ('alpha', 'beta' and 'gamma') in the checkbox group for the 'greekletters' control.
        
        
        
        'Note:
        'Assume your callback submitted data from the 'Grid' part, row 3:
        'e._set.lastname.value = "Smith" gets converted to this Javascript code: '{grid.object}.setValue('G','LASTNAME',3,'' + 'Smith',true);' and this code is automatically added to the Ajax response.
        
        'Note:
        'In addition to 'e._set', you can set properties of the 'e._setElement', 'e._setGridElement' and 'e._setRow<rowNumber>' objects.
        'Examples:
        'e._setRow3.lastname.value = "Smith"
        'e._setRow_1.firstname.value = "John" --- sets the value in the first New Record row
        'e._setElement.DIV1.value = "Some text" --- sets the innerHTML of DIV with the id of 'DIV1'
        'e._setGridElement.SPN2.style.color = "Red" ---- sets style properties of a SPAN with id of '{grid.componentname}.SPN2'
        
        
        'example code:
        'Return a Javascript command
        'GetCurrUser = "alert('You submitted a value of: " + js_escape(e._currentRowDataNew.lastname) + "');"
        
        e._set.username.value = a5ws_getcurrentuser()
        
        end function
        As usual, there are a few ways to get this done... this is just one way.
        You can hide the fields in the grid so you don't see the fields being populated.
        Hope that helps a bit.

        Comment

        Working...
        X