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

Questions about the Sample App

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

  • Questions about the Sample App

    Hopefully, many of you have had an opportunity to load up the Tablet Sample App and start working with it. The Sample App is meant to give you a launching point to build your own applications as well as serve as an educational guide. To that end, we would like to hear any questions you may have about the Sample Application.

    Post your questions in this thread or as new topics in the Beta Forum so that we and other Beta users can answer them for you.

    Thanks!

    Tablet Sample Application Overview



    Video Link: http://www.alphasoftware.com/video-library/?v=4896
    Last edited by Sarah Mitchell; 09-14-2015, 01:42 PM.
    Sarah Mitchell
    Documentation | Alpha Software Corporation
    Get in the know! Join us for our Weekly Webinars: TransForm Tuesday and Wednesday's Alpha Anywhere Demo and Q&A
    Connect with us: Instagram | Twitter | Facebook | LinkedIn | YouTube


  • #2
    Re: Questions about the Sample App

    I would like to upload a screen shot to help to ask my question about the sample application and how I can make simple modifications such as spelling the current BreakPadRR "BrakePadRR" instead...I did this in the static source List1, but could not change it beyond that. I have a screen shot I would like to attach, but have not used this feature yet, and have not been able to do so. Thanks for any advice. Ken

    Comment


    • #3
      Re: Questions about the Sample App

      Originally posted by kctermite View Post
      I would like to upload a screen shot to help to ask my question about the sample application and how I can make simple modifications such as spelling the current BreakPadRR "BrakePadRR" instead...I did this in the static source List1, but could not change it beyond that. I have a screen shot I would like to attach, but have not used this feature yet, and have not been able to do so. Thanks for any advice. Ken
      Hi Ken,

      Thanks for sending your screenshot to me. I passed this along to the dev team. The error could be reproduced by opening any of the FormView controls on the sample app and clicking OK. There's a simple workaround you can use until the issue is fixed:
      1. Go to the CSS Tab in the Form View Builder
      2. Click on "CSS defined specifically for this Control" and type a space in the CSS
      3. Click on "CSS defined at the UX component level" and type a space in the CSS
      4. Click OK


      A fix will be in tomorrow's build.

      If you encounter any problems in the future, feel free to report them here on the forum. You can also send an email to tabletbeta@alphasoftware.com.

      Thanks!
      Last edited by Sarah Mitchell; 09-21-2015, 12:37 PM.
      Sarah Mitchell
      Documentation | Alpha Software Corporation
      Get in the know! Join us for our Weekly Webinars: TransForm Tuesday and Wednesday's Alpha Anywhere Demo and Q&A
      Connect with us: Instagram | Twitter | Facebook | LinkedIn | YouTube

      Comment


      • #4
        Re: Questions about the Sample App

        Thank you!

        The work-around did the trick.

        Now I am ready to try again making the database table from which to populate the List1 to verify that I know what to do to obtain the data, edit the data, save the data, and see it again. Previously, I could not even correct the spelling of BrakePadRR (sample has it as BreakPadRR which does not agree with the spelling of any of the other Brake Pads) without an error. Glad to find out this was a "bug" and that it can be controlled until such time as it is exterminated.

        Ken

        Comment


        • #5
          Re: Questions about the Sample App

          A common requirement is to store a foreign key in a record, but present a longer form description to the user in the UI. For example, in the sample tablet app a list of states is presented as a sort of dropdown list. The "long form" string representation is shown in the list of values to select from (say 'Alabama'), but when the user selects an item, the abbreviation for the state (say 'AL') is presented in the form field.

          I would like to store the foreign key "ID" (value) in the database ('AL" in my example), but show the long form description (text - "Alabama' in my example) in both the dropdown list, and and in the form field after it is selected. In other words, I don't want the user to ever see 'AL' in the UI, but I want to save 'AL' in the database. Can you provide some guidance on how this might be done?

          Thanks.

          Doug

          Comment


          • #6
            Re: Questions about the Sample App

            Originally posted by dougeven View Post
            I would like to store the foreign key "ID" (value) in the database ('AL" in my example), but show the long form description (text - "Alabama' in my example) in both the dropdown list, and and in the form field after it is selected. In other words, I don't want the user to ever see 'AL' in the UI, but I want to save 'AL' in the database. Can you provide some guidance on how this might be done?
            Doug
            Any help or pointers on this? Struggling a bit here. Thanks.

            Comment


            • #7
              Re: Questions about the Sample App

              Originally posted by dougeven View Post
              Any help or pointers on this? Struggling a bit here. Thanks.
              Hi Doug,

              Have you watched Editors: Using a Dropdown Box? I definitely recommend watching it as the example I've built uses some of the methods discussed.

              For lists of data retrieved from a database, one way you could tackle this problem is with Client-side Data Cache. In the attached example, I have setup a client side data cache item called "states" that retrieves a list of states & their corresponding codes from a database table. I have created a second client-side data cached item called "fruit" that contains a static JSON object of a list of fruit. The "states" are used to populate the dropdown box when the state field is edited while the "fruit" contains the list of data to populate the dropdown box with when the fruit field is edited.

              dropdownFromDB.png

              In the FormView, I used the "User defined editor and template settings" to add a setting that contains the name of the data cache item to retrieved. For lack of a better word, this item is called "list". For the state field, it is set to "states". For the fruit field, "fruit".

              Finally, in the "Set value in Editor" event for EDITOR_1, I added the code that retrieves the item from the data cache & populates the dropdown box.

              Items in the attached zip include a UX component and a SQL file that contains the table definition and data I used in my example. You'll need to update the Client-side Data Cache to reference the correct connection string to reference the states table.

              dropdownFromDatabase.zip

              As for displaying the value in the FormView, you can use Client-side Templating to transform the stored value to the appropriate displayed value. With the client-side data cache, you should be able to lookup the "displayed" value and show that when the FormView renders the record.

              Good Luck!
              Sarah Mitchell
              Documentation | Alpha Software Corporation
              Get in the know! Join us for our Weekly Webinars: TransForm Tuesday and Wednesday's Alpha Anywhere Demo and Q&A
              Connect with us: Instagram | Twitter | Facebook | LinkedIn | YouTube

              Comment


              • #8
                Re: Questions about the Sample App

                Hi. I am saving collected information in a table I named "sample" in a MySQL database, with the fields as per the sample application, but haven't yet figured out how to save the settings of the PASS/FAIL items. Nothing, of course, gets written to the sample table; so, the items do not retain their red or green color from one use to the next. Can the PASS/FAIL (maybe 0's and 1's or T's and F's or "Yes" and "No" be saved in the table and if so, type character? tinyint? Ken

                Comment


                • #9
                  Re: Questions about the Sample App

                  Originally posted by kctermite View Post
                  Hi. I am saving collected information in a table I named "sample" in a MySQL database, with the fields as per the sample application, but haven't yet figured out how to save the settings of the PASS/FAIL items. Nothing, of course, gets written to the sample table; so, the items do not retain their red or green color from one use to the next. Can the PASS/FAIL (maybe 0's and 1's or T's and F's or "Yes" and "No" be saved in the table and if so, type character? tinyint? Ken
                  Yes. The Pass/Fail control returns a value - "Pass" or "Fail" - when the editor is saved. You could take this value and store it verbatim or apply a translation that returned whatever value you needed to store it in a database.

                  Take a look at the "EDITORCHECKLISTITEM". In the "Set value in editor" event, you could insert code here that set the checklist item appropriately. If, for example, you wanted to store 1 for Pass and 0 for Fail:
                  Code:
                  var vbobj = {dialog.Object}.getControl('radiobuttons');
                  vbobj.populate({choices:["Pass","Fail"]});
                  
                  // remove the explicit class on the ViewBox
                  $rcn($(vbobj.contId),"choiceNoValue"); 
                  
                  if (value == 1) {
                  	vbobj.setValue("Pass");
                  } else if (value == 0) {
                  	vbobj.setValue("Fail");
                  }
                  
                  // defined in the JavaScript part of the radiobuttons ViewBox to set class for no-choice
                  choiceHandleNull(vbobj, value);
                  The if block checks the value of your item. If it's 1, the checklist item is set to "Pass". If it's 0, "Fail".

                  To get the value back out, you would need to modify the Get value from editor event:
                  Code:
                  var vbobj = {dialog.Object}.getControl('radiobuttons');
                  var r = "";
                  if (vbobj.value == "Pass") {
                      r = 1;
                  } else if (vbobj.value == "Fail") {
                      r = 0;
                  }
                  return r;
                  If you wanted to take this an extra step, you could modify the checklist item itself to handle a different stored value from the displayed value. You would need to change the Static JSON Data to handle an array of objects rather than an array of values:
                  Code:
                  [
                    { choice:"Pass", value:true },
                    { choice:"Fail", value:false}
                  ]
                  You would need to do some additional coding to get this working (eg, you'll have to update the ViewBox Layout to reference the "choice" and "value" fields. You'd also need to make modifications to the code that gets and sets the value in the editor.)

                  By modifying the checklist item to have a separate "stored" value from a "displayed" value, you can handle showing many different types of fields whose underlying representation can be any value. EG, you could have one field that stores True and False as 1 and 0 and another that stored it as "T" and "F" in the database. In the setup, you could use the "User defined editor and template settings" to specify the list of choices you want shown. This would let you do something like this when the editor is populated:

                  Code:
                  //choices is a JSON object defining the list of choices
                  //to display in the checklist item
                  var choices = settings["choices"];
                  
                  var vbobj = {dialog.Object}.getControl('radiobuttons');
                  vbobj.populate(choices);
                  
                  // remove the explicit class on the ViewBox
                  $rcn($(vbobj.contId),"choiceNoValue"); 
                  
                  // defined in the JavaScript part of the radiobuttons ViewBox to set class for no-choice
                  choiceHandleNull(vbobj, value);
                  Good luck!
                  Sarah Mitchell
                  Documentation | Alpha Software Corporation
                  Get in the know! Join us for our Weekly Webinars: TransForm Tuesday and Wednesday's Alpha Anywhere Demo and Q&A
                  Connect with us: Instagram | Twitter | Facebook | LinkedIn | YouTube

                  Comment


                  • #10
                    Re: Questions about the Sample App

                    Originally posted by kctermite View Post
                    haven't yet figured out how to save the settings of the PASS/FAIL items
                    I realize I haven't addressed this specific part of your question.

                    Saving the values back to the list is handled by the FormView control. You should be able to insert a save and cancel button in the FormView layout - they're listed as predefined controls.

                    Saving the data in the checklist item back to the FormView requires either that the Editor Set is configured to automatically commit the changes when the Editor is closed or that you add a button or link that the user can click to commit the data. Inside the button, you'll need to add code that looks similar to the following:
                    Code:
                    // get name of containing EDITOR_SET for the checklist item editor
                    var edObj = {dialog.object}._EDITOR_EDITORSET['EDITORCHECKLISTITEM'];
                    var es = '';
                    if(typeof edObj != 'undefined') es = edObj.editorSet;
                    if(typeof es == 'undefined') es = '';
                    
                    if(es != '') { 
                    	var closeEditorAfterCommit = true;
                    	{dialog.object}.editorCommit(es,closeEditorAfterCommit);
                    }
                    The predefined editors all include buttons for saving or resetting the editor data. I would suggest looking at the Editor-TextBox to see how you would implement both save and cancel.

                    The auto commit option is available in the Properties for an Editor Set container - listed in the "Editor Set Properties" section.

                    The "Get value from editor" event is used by the commit operation to save the data back to the FormView. This event should return the value to store.
                    Sarah Mitchell
                    Documentation | Alpha Software Corporation
                    Get in the know! Join us for our Weekly Webinars: TransForm Tuesday and Wednesday's Alpha Anywhere Demo and Q&A
                    Connect with us: Instagram | Twitter | Facebook | LinkedIn | YouTube

                    Comment


                    • #11
                      Re: Questions about the Sample App

                      Originally posted by Beta Spark View Post
                      As for displaying the value in the FormView, you can use Client-side Templating to transform the stored value to the appropriate displayed value. With the client-side data cache, you should be able to lookup the "displayed" value and show that when the FormView renders the record.
                      Thanks for this example! I think I have a handle on what you've done with client-side data cache and the dropdown list. A working example helps a lot! I'm at a loss, though, as to how to use client-side templating to transform the stored value. I think I can write the javascript necessary to look up the appropriate value to display from the data cache, but it's not clear to me how to inject this javascript into the field template. Is there a special template syntax that enables injecting javascript directly into the field template (similar to the *if conditional token)? Or is there an event on the editor or the formview somewhere that should be used? Something else?

                      Thanks for your help. It's very much appreciated.

                      Comment


                      • #12
                        Re: Questions about the Sample App

                        Originally posted by dougeven View Post
                        Thanks for this example! I think I have a handle on what you've done with client-side data cache and the dropdown list. A working example helps a lot! I'm at a loss, though, as to how to use client-side templating to transform the stored value. I think I can write the javascript necessary to look up the appropriate value to display from the data cache, but it's not clear to me how to inject this javascript into the field template. Is there a special template syntax that enables injecting javascript directly into the field template (similar to the *if conditional token)? Or is there an event on the editor or the formview somewhere that should be used? Something else?

                        Thanks for your help. It's very much appreciated.
                        Yes. You can use Javascript functions in templates! This is from the release notes. You can also find a copy of the template syntax documentation inside the Template Tester.
                        Functions - {@JavascriptFunctionName}

                        Your template can include calls to Javascript functions that compute values based on data in the current 'row'. To call a function you use the {@JavascriptFunctionName} placeholder in your template, where JavascriptFunctionName is the name of the Javascript function that you want to call.

                        The value returned by the function is emitted for the placeholder.

                        The Javascript function takes a single parameter, data, which allows you to reference data from the current row.

                        Consider the following simple data object:
                        Code:
                        {firstname: 'John', lastname: 'Smith'}
                        And the following template:
                        Code:
                        Hello {@fullname}
                        The fullname Javascript function might be defined as:
                        Code:
                        function fullname(data) {
                        
                            return data.firstname + ' ' + data.lastname.toUpperCase();
                        
                        }
                        The template result for the above data, template and Javascript function will be:
                        Code:
                        Hello John SMITH
                        Note: if you're using the client side data cache, be aware that retrieving data out of the data cache is an asynchronous operation. When the data is retrieved using the Action JavaScript (I copied the action Javascript implementation so I could use it in the editor setup) it performs a callback after the operation completes (passes or fails.) The template function will want you to return a value. So, you'll either have to preemptively fetch the data for use in the templates or design your template such that you can use a method like $svs() to set the value after the fact.

                        This is just a way to do this operation. You could also fetch data server-side using xbasic when the UX component is first loaded and store it in state variables or include an extra field in your List control for the "display" value for use in the FormView.
                        Sarah Mitchell
                        Documentation | Alpha Software Corporation
                        Get in the know! Join us for our Weekly Webinars: TransForm Tuesday and Wednesday's Alpha Anywhere Demo and Q&A
                        Connect with us: Instagram | Twitter | Facebook | LinkedIn | YouTube

                        Comment


                        • #13
                          Re: Questions about the Sample App

                          Originally posted by Beta Spark View Post
                          Yes. You can use Javascript functions in templates!
                          Thank you! I've got something that seems to be working for me. In the meantime I'm encountering another issue that may possibly be a bug introduced in the beta.

                          When I run the sample app in Working Preview I can no longer navigate to any of the panels from the first one. The "DETAILS" panel is shown and can be navigated successfully, but when an attempt is made to navigate to another panel (SECTION 1, SECTION 2, NOTES) nothing happens. An error is logged to the console. See attached screenshot for the text of the error message that appears there. I noticed this last night and downloaded both the latest build of AA and re-downloaded the sample app this morning to be sure this issue isn't related to some change I made.

                          Please let me know if I can provide further information that would be helpful in tracking this issue down.

                          Thanks.
                          AATablet_Sample_Error.PNG

                          Comment

                          Working...
                          X