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

Insert new record at top of list

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

    Insert new record at top of list

    Hi,

    I am adding new records to a list using a formview. I would like the new records to be inserted at the top of the list. By default, they get added to the bottom of the list.

    I have tried using the method "formviewrow" and setting the row number to 0 before committing the new record to the list. Although it places the new record at the top of the list, it replaces the existing record at the top of the list, rather than pushing the existing rows down and inserting the new row.

    Any ideas on how I could do this ?

    cheers,
    Greg

    #2
    Re: Insert new record at top of list

    If the list is sorted in the right order, you can just refresh or re-sort the list after adding a new record. Then it will fall wherever it sorts to. If sorted by the ID or created date/time (desc) it will be at the top.

    Otherwise, if this is not an option for the list, you might send in a new feature request. Adding to the top is an available on a Grid.

    Comment


      #3
      Re: Insert new record at top of list

      See if this helps as well .. https://forum.alphasoftware.com/show...highlight=list
      Alpha Anywhere v12.4.6.5.2 Build 8867-5691 IIS v10.0 on Windows Server 2019 Std in Hyper-V

      Comment


        #4
        Re: Insert new record at top of list

        I looked at the post mentioned by 'iRadiate'. I ran into two problems:

        1. The last post entered by Simone mentions problems with child lists. I also have the same problem. Once I specify to transform the 'Id' field to a number in the list properties (Fields->Transform Data Type->ToNumberSimple), the child list no longer links up to the parent list properly. I guess its due to the fact I'm using the 'Id' field as the linking field between the child and parent.
        2. If I add a new record when I'm offline, an 'Id' is not assigned until I am back online and do a 'sync'. In this scenario, the new record is placed at the bottom of the list.

        Greg

        Comment


          #5
          Re: Insert new record at top of list

          Re point 1, I found a section in the List Properties called "Client-side Filter/Order, and Grouping". The"Order" property lets you setup an expression which will determine the lists order. If I enter:
          Id|Number|Desc
          then the list will order in descending order based on the Id field.
          Regarding point 2, the only solution I can find is to set the selected row in the list to the last row using the <listObj>.setValue method. I need to use a setTimeout to specify a small delay (~150ms), which causes a slight flicker on the formview (since when I save the formview it wants to set the selected row back to 0), then when I set the selected row back to the last row, I can temporarily see the data in the form for row 0.

          greg

          Comment


            #6
            Re: Insert new record at top of list

            You should post the version/build you're using.

            You could do an end run around the FormView and look after updating the List yourself. I don't know what .formViewCommit() is doing specifically... but it must be running some kind of .addTableRow() against the List Control.

            .addTableRow() offers the options you're looking for. What you'll need to do is set some kind of flag to indicate that you're in an "add" state... not an update.

            In the FormView Save code you could do something like this...

            Code:
            var result = {dialog.object}.formViewValidate('{form.id}');
            //only commit if there are no form validation errors
            if(result){
            	var vb = {dialog.object}.formViewGetViewBox('FORMVIEW_1');
            	var vbData = vb.data;
            	
            	var listObj = {dialog.object}.getControl('list');
            	var ops = {};
            	ops.setFocusToTargetRow = true;
            	ops.insertRow = true;
            	ops.insertPosition = 0;
            	listObj.addTableRow(vbData,ops);
            }
            Here we get the FormView ViewBox object. Then we get the data in that object... the data you just created as a new record.
            Then we get the List Control object.
            The options available for .addTableRow() include the position where you want the data. Set it to zero and you're at the top.

            Comment


              #7
              Re: Insert new record at top of list

              Thanks David. Will try it and let you know.

              Comment

              Working...
              X