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

Alert when filtered list returns zero records

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

  • Ronald Anusiewicz
    replied
    Re: Alert when filtered list returns zero records

    Charles,

    I've been working with desktop apps since 1992. I'm in the habit of using variables and not knowing any better, I thought that this my be the way to go. I have since changed my approach, but now I'm having other issues.

    http://www.alphasoftware.com/alphafo...esh-Panel-Card

    Thanks for your help.

    Leave a comment:


  • CharlesParker
    replied
    Re: Alert when filtered list returns zero records

    There really has to be a better way than using a session variable and changing it to change a button. I still really don't understand what you want exactly though. Client side seems like all you need though as far as I can tell.

    Leave a comment:


  • Ronald Anusiewicz
    replied
    Re: Alert when filtered list returns zero records

    First, thanks for your help. I finally figured most of this out. I'm using a session variable, True/False, for an enable expression on the button. This works fine.

    What I can't seem to figure out is how to refresh the button when the enable expression session variable has been changed.

    The button is on panel card A. When I go to panel card B or panel card C, I have code that changes the value of the session variable. When I return to Panel card A, the button is still in the same state as before. The session variable has indeed been changed, but the button needs to be refreshed.

    How does one do this?

    Leave a comment:


  • CharlesParker
    replied
    Re: Alert when filtered list returns zero records

    Unless I am missing something, there is an option in the list control already to display a default message in the list control when there are no records to display...at least in ver 4 there is. I use it on every list. To stop the action, why not put the controls in a seperate panel card, limit the query to 5 results (or less) then hide the button if the record count is less than 1?
    it seems like if you press the button, your going to make an ajax callback - retrieve the records and then run the code to determine if there should be an alert.
    It might be "perceived faster" if you were loading the records first.
    This would be in contrast to opening a seperate UX to do something with the records.

    At least you would already know if the list was empty...
    Last edited by CharlesParker; 05-29-2016, 12:49 PM.

    Leave a comment:


  • Ronald Anusiewicz
    replied
    Re: Alert when filtered list returns zero records

    David, thank you for your patience.

    If FIXENTRIES is in the Child UX... then you do have to reference the Child... using {dialog.Object}.getChildObject(alias [,componentType]). Your Embedded UX must be given an Alias - it's one of the Embedded Object properties. Once you've set the alias you can do something like this...
    Code:
    var cObj = {dialog.Object}.getChildObject('myChildUXAlias');
    Once you have a pointer to the Child UX... you can do this for FIXENTRIES...

    Code:
    var lObj = cObj.getControl('FIXENTRIES');
    and then continue on with your count and test.
    This is what I'm trying to do. My first mistake was the Alias. I got that straight. Now I'm getting an error when debugging the script.

    Code:
    var cObj = {dialog.Object}.getChildObject('OPEN_LBR');
    
    var lObj = cObj.getControl('FIXENTRIES');
    debug.JPG

    I'm curious as I see that cObj = false in the debugger.
    Could that be the problem?

    Leave a comment:


  • Davidk
    replied
    Re: Alert when filtered list returns zero records

    I'm afraid you're still not making it very clear. You need to post info here about what is in the Parent UX and what is in the Child UX.

    Where is FIXENTRIES?

    If the List, FIXENTRIES, is in the Parent... and you're activating a PanelCard, MY_LABOR_ENTRIES, which is also in the Parent, then you do not necessarily need to reference the Child UX.

    You're just counting the number of rows in FIXENTRIES and deciding to move to MY_LABOR_ENTRIES (which is in the Parent)... or not.

    If FIXENTRIES is in the Child UX... then you do have to reference the Child... using {dialog.Object}.getChildObject(alias [,componentType]). Your Embedded UX must be given an Alias - it's one of the Embedded Object properties. Once you've set the alias you can do something like this...

    Code:
    var cObj = {dialog.Object}.getChildObject('myChildUXAlias');
    Once you have a pointer to the Child UX... you can do this for FIXENTRIES...

    Code:
    var lObj = cObj.getControl('FIXENTRIES');
    and then continue on with your count and test.

    Leave a comment:


  • Ronald Anusiewicz
    replied
    Re: Alert when filtered list returns zero records

    David,

    I built a test UX and I did get the code working. This is because the button is in the same UX component as the list.
    So it appears that my real problem is:

    1. the button is on the parent UX
    2. the child UX has the list
    3. the child UX is an Embedded Object, MechLbr_Edit, in the panel card: MY_LABOR_ENTRIES of the parent UX

    List.JPG

    So the code:

    Code:
    var lObj = {dialog.object}.getControl('FIXENTRIES');
    var count = lObj._rData.length;
    needs to be changes to reference the embedded UX.

    Not sure how to code this.

    Leave a comment:


  • Davidk
    replied
    Re: Alert when filtered list returns zero records

    Because you're running in a browser (Chrome and Firefox being the best for debugger) you are in the best place to debug Javascript. Firefox, with the Firebug plugin will give you buckets of information. Chrome I find a bit quicker for the simpler things. Run your UX in Chrome, with a debugger; statement in your code. Because you're not getting an alert I'd guess something's breaking. Are you sure your List control has a variable name of 'FIXENTRIES'?

    Debugger will show any errors.

    Leave a comment:


  • Ronald Anusiewicz
    replied
    Re: Alert when filtered list returns zero records

    I tried this code in the Javascript-click event for the button:

    Code:
    var lObj = {dialog.object}.getControl('FIXENTRIES');
    var count = lObj._rData.length;
    alert(count);
    then I tried this:

    Code:
    var lObj = {dialog.object}.getControl('FIXENTRIES');
    var count = lObj._state.recordCount;
    alert(count);
    and nothing happens. No Alert message, nothing.

    Because I have security enabled, I have to test while running the UX components in a browser from the local webroot.
    I don't think I can run a debug that way.

    I think I need to do a text UX component and experiment with that.

    Thanks.
    Last edited by Ronald Anusiewicz; 05-23-2016, 11:20 PM.

    Leave a comment:


  • Ronald Anusiewicz
    replied
    Re: Alert when filtered list returns zero records

    Dave, at first glance, what you say makes a lot of sense. So then I thought all I would have to do is to use the list filter in the button's enable expression. I looked at the filter expression and realized that the list is being built on the server side. I do not have everything I need client side. Specifically, the fields POSTED and LOCKED are not used at all client side.

    Code:
    SITE = :argSite .AND. POSTED = .F. .AND. LOCKED <> .T. .AND. MECHANIC = :argMechanic
    That's why I took my initial approach.

    Leave a comment:


  • Davidk
    replied
    Re: Alert when filtered list returns zero records

    You shouldn't be doing this server-side when you have everything you need client-side... which is what you're trying to do as in your first post.

    What button gets pressed on the first UX? Is it in the List control? Is it separate from the FIXENTRIES List? Essentially, you don't want that button enabled if there are no records in FIXENTRIES... is that right?

    Just ran a UX with a List control, DBF as data source. Your code works... both methods.

    When you say if doesn't work... what does that mean? Are there errors being reported when you inspect the page? Put a debugger statement at the top of your code, fire up the UX in Chrome, Inspect the page, press the button, and walk through your code.
    Last edited by Davidk; 05-23-2016, 10:37 PM.

    Leave a comment:


  • Ronald Anusiewicz
    replied
    Re: Alert when filtered list returns zero records

    I did find similar code on this board. I'm building the list against a DBF file. I don't see an afterQuery event anywhere. I don't believe that option is available for DBF tables. So I'm looking for another option.

    Thank you.

    Leave a comment:


  • -Jinx-
    replied
    Re: Alert when filtered list returns zero records

    I'm not sure if you are using a client or server-side filter, but if it's server-side, in the list builder, on the data source tab, you could define a Server-side afterQuery event. Let's say you'd call it: AfterListQuery
    The Xbasic for that event could look something like this:
    Code:
    function AfterListQuery as v (e as p)
    
    if e.recordsInQuery < 1 then
    	e.javascript = "alert('Your search retured 0 records.');"
    else
    	e.javascript = "{dialog.object}.panelSetActive('MY_LABOR_ENTRIES',true);"
    end if
    
    end function
    I haven't tested it, but I use something similar and it works for me.
    Last edited by -Jinx-; 05-23-2016, 01:46 PM.

    Leave a comment:


  • Alert when filtered list returns zero records

    I'm using a DBF file.
    I have 2 UX components.
    The first component calls the second which is an embedded UX component.
    The second UX component has a control which is a filtered list.
    The list is filtered on session variables and hard coding of selected fields in the record.

    When pressing the button on the first UX, the code selects the Panel card containing the embedded UX with the filtered list.

    If the list is empty, I would like to display a message stating so and stop the activation of the MY_LABOR_ENTRIES panel.

    I've been trying examples I have found on this board without any luck.

    This doesn't work.

    Code:
    var lObj = {dialog.object}.getControl('FIXENTRIES');
    var count = lObj._state.recordCount;
    alert(count);
    
    var lObj = {dialog.object}.getControl('FIXENTRIES');
    var count = lObj._rData.length;
    alert(count);
    
    
    if(count < 1){
    	alert('There are No Entries Available for Editing.');  
    } else {
    	{dialog.object}.panelSetActive('MY_LABOR_ENTRIES',true);
    }
    Thanks for any help.
Working...
X