Alpha Video Training
Results 1 to 7 of 7

Thread: Dynamically populating a list control from another list control

  1. #1
    Member
    Real Name
    JonMichael Smith
    Join Date
    Jul 2018
    Posts
    30

    Default Dynamically populating a list control from another list control

    Hi, so I am working on an app that can go online and offline using persist to local data. Long story short in order for me to be able to use a search button without doing any ajax callbacks to my server, I need two list controls. One for my sequel server to feed into, and one static list control that is being populated by the first one.
    Before you start saying "Well you can just use the 'search client side' action scripting!", you should know that I am using the search function in a button to filter my list control into 3 groups by searching in a specific field for a specific value, and the client-side search function is underwhelmingly unhelpful by simply doing a keyword search across the entire table, without giving me the option to search in a specific field.

    So I could really use some help with any ideas on how to essentially replicate a sql server based list control to a static one! I have tried making my own function using .appendrows(JSON); but I can't seem to stuff my arrays correctly into the json, so I tried it with a javascript object and that didn't seem to work either. I am fairly new to javascript so if you have any suggestions there that would also help! Thanks guys!

    Code:
    function populate_entireroutelist() {
    	var reading_pntr = {dialog.object}.getControl('READINGS');
    	var entireroute_pntr = {dialog.object}.getControl('ENTIREROUTE');
    	
    	var route_length = reading_pntr._data.length; //gets the length of the route
    	
    	var counter = 1;
    	
    	reading_pntr.setValue(0);//sets focus to the beginning
    	
    	var serviceAddress_holder;//we define our variables
    	var customerName_holder;
    	var read_unread_holder;
    	var currentReading_holder;
    	
    	var _d = {}; //here we defined our object
    	
    	var serviceAddress = [];
    	var customerName = [];
    	var read_unread = [];
    	var currentReading = [];
    	
    	for(i = 0; route_length > i; i++){ //this for loop creates the four arrays that I want to load into my object and display as variables into my static list
    		serviceAddress_holder = {dialog.object}.getValue('serviceAddress');//this loads in the data into the variables
    		customerName_holder = {dialog.object}.getValue('customerName');
    		read_unread_holder = {dialog.object}.getValue('FILLER1');
    		currentReading_holder = {dialog.object}.getValue('currentReading');
    		
    		serviceAddress[serviceAddress.length] = serviceAddress_holder;//this assigns it into the next index into the array
    		customerName[customerName.length] = customerName_holder;
    		read_unread[read_unread.length] = read_unread_holder; 
    		currentReading[currentReading.length] = currentReading_holder;
    		
    		reading_pntr.setValue(counter); //this takes us to the next record
    		counter++;	
    		}
    		
    		_d.serviceAddress = [];
    		_d.customerName = [];
    		_d.read_unread = [];
    		_d.currentReading = [];
    		
    		for(i = 0; route_length > i; i++){// this is where I stuff those arrays into my object
    		_d.serviceAddress[i] = serviceAddress[i];
    		_d.customerName[i] = customerName[i];
    		_d.read_unread[i] = read_unread[i];
    		_d.currentReading[i] = currentReading[i];
    		}
    		
    		entireroute_pntr.appendRows(_d);//this is where I finally try to append the rows onto my list control
    		entireroute_pntr.setValue(0);//set focus to first row
    		}

  2. #2
    "Certified" Alphaholic CharlesParker's Avatar
    Real Name
    Charles Parker
    Join Date
    Dec 2012
    Location
    New Orleans, LA
    Posts
    2,060

    Default Re: Dynamically populating a list control from another list control

    are you using keyword search or just fields from the list control within the client side search function?
    NWCOPRO Nuisance Wildlife Control Software-My Application: http://www.nwcopro.com "I am not discouraged, because every wrong attempt discarded is another step forward."

  3. #3
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,566

    Default Re: Dynamically populating a list control from another list control

    Not really sure what you're trying to accomplish... but you may be making this overly complicated.

    Have a look at using the method...

    Code:
    <listObject>.setFilter(searchDefinition);
    Excellent in-line doc... and here... https://www.alphasoftware.com/docume...r%20Method.xml

  4. #4
    "Certified" Alphaholic CharlesParker's Avatar
    Real Name
    Charles Parker
    Join Date
    Dec 2012
    Location
    New Orleans, LA
    Posts
    2,060

    Default Re: Dynamically populating a list control from another list control

    I believe in the list builder itself there is an option to convert it static data, btw
    NWCOPRO Nuisance Wildlife Control Software-My Application: http://www.nwcopro.com "I am not discouraged, because every wrong attempt discarded is another step forward."

  5. #5
    "Certified" Alphaholic iRadiate's Avatar
    Real Name
    Stephen
    Join Date
    Jan 2011
    Location
    London, ON
    Posts
    1,572

    Default Re: Dynamically populating a list control from another list control

    Not sure if this is what you are looking for, perhaps some of the methods may help .. https://www.youtube.com/watch?v=wqD015PuoT0
    Alpha Anywhere v12.4.6.0.2 Build 5943-5324 IIS v8.5 on Windows Server 2012 in Hyper-V

  6. #6
    Member
    Real Name
    JonMichael Smith
    Join Date
    Jul 2018
    Posts
    30

    Default Re: Dynamically populating a list control from another list control

    Quote Originally Posted by CharlesParker View Post
    are you using keyword search or just fields from the list control within the client side search function?
    This is what I was talking about when I said that the server side search was underwhelmingly unhelpful, because the built in action scripting doesn't allow you to select the search type, nor the column to search in!

  7. #7
    Member
    Real Name
    JonMichael Smith
    Join Date
    Jul 2018
    Posts
    30

    Default Re: Dynamically populating a list control from another list control

    Quote Originally Posted by Davidk View Post
    Not really sure what you're trying to accomplish... but you may be making this overly complicated.

    Have a look at using the method...

    Code:
    <listObject>.setFilter(searchDefinition);
    Excellent in-line doc... and here... https://www.alphasoftware.com/docume...r%20Method.xml
    Thanks for the help David! You have saved me hours of work! I just used this code with a client side sort, and now I can pull up my three different groups of records without doing an ajax call back!

Similar Threads

  1. Replies: 7
    Last Post: 10-17-2018, 10:30 PM
  2. Dynamically populate fields into a list control
    By Peter.Greulich in forum Mobile & Browser Applications
    Replies: 7
    Last Post: 03-02-2015, 08:37 AM
  3. trouble populating a dialogue from a list control selection
    By wenbaugh in forum Mobile & Browser Applications
    Replies: 2
    Last Post: 04-06-2014, 08:44 AM
  4. Dynamically Re-populating Choices in a Dropdownbox Control
    By Atta in forum Application Server Version 11 - Web/Browser Applications
    Replies: 2
    Last Post: 09-17-2012, 10:59 PM
  5. Populating a tree control dynamically
    By Selwyn Rabins in forum Alpha Five Version 6
    Replies: 8
    Last Post: 11-08-2004, 04:27 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •