Jump to content


Caspio Ninja
  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by JEllington

  1. Resolved: the key to the issue is in the topic title. I had to reverse my logic and wrap the .map.filter within the forEach. This worked, but as .map.filter creates an array with the same name, each previous iteration was overwritten by the current iteration. The final solution wast to use another nested forEach instead of the .map.filter, then push the result to the eleBtn array. //button objects array var buttons = [ { eleId: "btnStop1", disp: "red", stat: "on" }, { eleId: "btnStop0", disp: "red", stat: "off" }, { eleId: "btnGo1", disp: "green", stat: "on" }, { eleId: "btnGo0", disp: "green", stat: "off" } ]; //display color array var eleColor = ["red", "green"]; //using the values of "eleColor" filtered through "buttons" //then store results in "eleBtn" var eleBtn = []; eleColor.forEach(ele => buttons.forEach(e => { if (e.disp === ele) {eleBtn.push(e)} })); console.log("eleBtn results", eleBtn); //eleBtn results (4) [{…}, {…}, {…}, {…}] // 0:{eleId: "btnUnassigned1", disp: "red", stat: "on"} // 1:{eleId: "btnUnassigned0", disp: "red", stat: "off"} // 2:{eleId: "btnOnsite1", disp: "green", stat: "on"} // 3:{eleId: "btnOnsite0", disp: "green", stat: "off"} // length:4
  2. Hello, I am having problems wrapping my head around nesting a forEach method within a .map .filter method. I have two arrays.. buttons: that contains key value pairs of button display statuses. eleColor: contains values that will be filtered through "buttons.disp" key values. I am using .map.filter methods to create a new array. When I assign the "disp" value statically all works and the new array is created. But when I try to iterate through eleColor for the parameter the code fails. Any recommendations on correct syntax or a better method to filter values from a different array is greatly appreciated. To make my objective clearer, I have included my code with explanation comments below. Thank you in advance for any and all comments/sugesstions on completing my objective. Jim //button objects array var buttons = [ { eleId: "btnStop1", disp: "red", stat: "on" }, { eleId: "btnStop0", disp: "red", stat: "off" }, { eleId: "btnGo1", disp: "green", stat: "on" }, { eleId: "btnGo0", disp: "green", stat: "off" } ]; //display color array var eleColor = ["red", "green"]; //create eleBtn array using the value of "red" filtered through "buttons" // this works filterring all disp: keys with the value of red.. eleBtn = buttons.map(e => e).filter(e => e.disp === "red"); console.log("eleBtn array ", eleBtn); // returns eleBtn array (2) [{…}, {…}] // 0:{eleId: "btnUnassigned1", disp: "red", stat: "on"} // 1:{eleId: "btnUnassigned0", disp: "red", stat: "off"} // length:2 //create eleButton array from "eleColor" filtered through "buttons" // but incorrect when eleColor array is iterated through forEach eleButton = buttons.map(e => e).filter(e => e.disp === (eleColor.forEach(ele => {ele}))); console.log("eleButton", eleButton); // how do I correctly iterate through each item in "eleColor", // so all red and green "disp" values are assigned to the "eleButton" array?
  3. just to put this out there.. if you are not concerned with the "Data Table" tooltip displaying on older (non ES6 compatible) browsers. You can skip the overhead of using jquery and use querySelectorAll with the script located at the end of the footer in your Tabular Report DataPages, such as... <!-- remove "Data Table" tooltip from Tabular report --> <script> document.querySelectorAll("table[data-cb-name='cbTable']")[0].removeAttribute("title"); </script> Keep in mind the reason for using the jquery in previous solutions is for backwards compatibility with older browsers that do not support querySelectorAll.
  4. Loading the script in the footer fixed the issue. With the script functioning correctly in legacy and not with async deployment, I didn't think to put the script code in the footer. Thank You so much for your help.
  5. Hello.. I have a tabular report that will not recognize an element using document.getElementById( "elmName" ) (loctated in the Header of a report), if the datapage is deployed using ASYNC deployment... <script type="text/javascript" src="http://b4.caspio.com/dp/d6a9blahblah/emb"></script> returning a console message " VM3106:22 Uncaught TypeError: Cannot set property 'innerHTML' of null". If i put the script in the console as.. document.getElementById( "elmName" ).innerHTML = '<a href="httpcodehere">Test Button</a>'; the script runs without errors and replaces the html in the <div id="elmName">Original Text</div>.I have found if I use the legacy deployment .. <script type="text/javascript" src="https://b4.caspio.com/scripts/e1.js"></script> <script type="application/javascript">try{f_cbload("d6a9blahblah","https:");}catch(v_e){;}</script> the script runs document.getElementById without errors. (I have tried running this script in other tabular report datapages deployed asynchronously all with the same error and results. Then switching them to legacy deployment and the script runs without error.) Can anyone give me any insight on why the document.getElementById will not work if the datapage is using ASYNC deployment?
  6. RESOLVED.. I was able to set the cbResultSetSearchAgainContainer display properties to none in the styles sheet..
  7. attached are screen shots of datapage resuylts with and without data. Search again only displays when no data is found for record
  8. Hello Vitlikssssss, yes I have unchecked all options. What is puzzling is the search again link only displays when there is no data found for the record (where if it were an option I would think it would show all the time regardless of the presence of data).
  9. Hello, I have a Details Report DataPage that if no data is found (351) the results html page displays a “Search Again” link button, that displays only if no data is found. I have gone into the styles for the page and disabled the search icon and in the localization cleared the “Search Again” in the labels and markers section and it still displays the Search Again link. If I put 1 character in the custom text area it displays just that one character but if I delete all characters in the area it reverts to displaying "Search Again". Can anyone please let me know how to disable the Search Again link altogether. All comments are greatly appreciated.
  10. Dazzler.. Thank you!! Brilliant fix. I was trying to figure out how to loop through each row and this does the trick perfectly. Many thanks on the amount of hair that can now remain on my head. (I was worried of pulling it all out over this one) Jim Ellington
  11. Since the CB 10.0 upgrade Ive been updating all the deploy codes in my datapages utilizing the new Asynchronous DataPage Deployment Method (a noticeable pageload improvement over the legacy deployment method, plus no more chrome deprecated warnings in the console Thank you for this improvement Caspio). One problem I am faced with now is I have several tabular report pages that conditionally load link buttons dependent on the status field of each row. With the legacy page deployment I was able to perform this with the following script in an html block... <script> var stat = '[@field:Status]' if (stat == 'Assigned') { document.write('<a class="recordActions" href="assignedwopage.html?on=[@field:WO_Num]&at=[@field:Assigned_Tech]&stat=begin">View/Open WO</a>'); } else if (stat == '~Suspended') { document.write('<a class="recordActions" href="resumewopage.html?on=[@field:WO_Num]&at=[@field:Assigned_Tech]">Resume WO</a>'); } else { document.write('<label>WO Pending Review</label>'); } </script> -------------------------------------------------------- The innerHTML solution I came up with to replace the document.write follows... <div id="linkto"></div> <script> var stat = '[@field:Status]' if (stat == 'Assigned') { document.getElementById("linkto").innerHTML = '<a class="recordActions" href="assignedwopage.html?on=[@field:WO_Num]&at=[@field:Assigned_Tech]&stat=begin">View/Open WO</a>'; } else if (stat == '~Suspended') { document.getElementById("linkto").innerHTML = '<a class="recordActions" href="resumewopage.html?on=[@field:WO_Num]&at=[@field:Assigned_Tech]">Resume WO</a>'; } else { document.getElementById("linkto").innerHTML = '<label>WO Pending Review</label>'; } </script> Apparently this does not work because the “linkto” div is an html collection within the html block and improperly assigns the last read value to only the first row in the table. I tried a createElement method along with several other ideas all with the same results. Can anyone please inform me on the proper method to perform for the desired result of displaying a link button conditionally in a report. Thanks in advance for any and all suggestions.
  12. I have a table with a field named Total_Time with a function datatype, that calculates total time using the flowing formula.. Round(((([@field:End_Hour] - [@field:Start_Hour]) * 60 + ([@field:End_Min]-[@field:Start_Min])) - (([@field:Break_Fin_Hour] - [@field:Break_Start_Hour]) * 60 + ([@field:Break_Fin_Min]-[@field:Break_Start_Min]))) /60 ,2) This works as expected… Now I would like to add a conditional statement that checks the value of the field "Assigned_Tech" and if the value is “Summary” then leave the Total_Time field blank, else run the formula. Im thinking.. CASE IF ([@field: Assigned_Tech])!==”Summary” THEN Round(((([@field:End_Hour] - [@field:Start_Hour]) * 60 + ([@field:End_Min]-[@field:Start_Min])) - (([@field:Break_Fin_Hour] - [@field:Break_Start_Hour]) * 60 + ([@field:Break_Fin_Min]-[@field:Break_Start_Min]))) /60 ,2) END Can someone please help me with the correct case statement to use. I spent 2 days writing the total_time formula and now am in a bit over my head using conditional statements in the formula. Thanks in advance for any an all help
  13. I am having a problem with the Signature Pad working correctly on an html page that has more than one datapage embedded in it. As per http://forums.caspio.com/index.php?/topic/4693-js-adding-a-digital-signature-to-a-submission-form The sig pad works as desired only in the first datapage embedded on an HTML page. Any additional datapages embedded into the html page throw console errors accessing the sig canvas. The problem is.. I have an HTML page that displays an invoice. The first embedded datapage displays customer information, a second embedded datpage displays inventory items used and a third datapage containing the sigpad script, requires a customer signature and collects closing details then submits the invoice. The third datapage throws console errors running the sig pad script. If I move the third datpage (the page that contains the signature script) to the top of the html page above the 1st and 2nd datapages the sigpag works correctly. Proving the script works only if it is contained within the first embedded datapage. To work around this I created an HTML popup window that handles the signature. except now I find that I must have the signature script within the third datpage. Any help on getting the sigpad working on an additional embedded datapage is greatly appreciated.
  14. The custom batch report works good. Is there a way to to save your session selections, so you dont have to go through the selection process every time? Thank You Mathilda
  15. I am able to export my apps manually one at a time (extremely time-consuming) through “Tools/Export”. Is there a way to batch export all Apps? I have setup “Scheduled Export Tasks” through DataHub on my account. I am able to export Tables and Views but do not see an option to export the App’s datas pages. Am I missing something or does the DataHub task scheduler only support tables and views for export. Thanks in advance for all sugestions
  16. Has anyone had any experience using the digital signature pad (http://forums.caspio.com/index.php?/topic/4693-js-adding-a-digital-signature-to-a-submission-form/) on a tablet? It mentions in the App notes that the pad is compatible with mobile devices. The signature works fine with a mouse on my desktop, but nothing on a touch screen tablet (Galaxy S2). Is there a setting in the tablet, or a plug-in that I need to enable (mouse drawing) functionality for the signature pad to work on a mobile device? UPDATE: my apologies for posting this thread without thoroughly researching the problem. After successfully testing the signature box on my phone and another tablet. I have concluded the issue is with my tablet. After a system reset the signature pad woks fine onthe tablet. Thank you Caspio and All for posting such helpful javascript snippets.
  17. Is Caspio running a "Changeup the Forum Layout" contest? Seems to be a different layout every few weeks. Just for the record, the layout currently deployed (mid august) leaves a lot to be desired. Links do not display until hovered over, leaving blank spaces/lines all over posts. Formatting characters are displayed in posts from older versions. Voting for threads? (whats that about..dont know as it does nothing) A lot of relevant information on threads is not displayed (how many views, etc). and difficult to maneuver. The previous layout from the end of July was far superior. In my humble opinion.
  18. I have a Results/Details datapage with <h3>User Details</h3> in the header and a Tabular Report datapage embedded on the same HTML page., both using "Modern Blue" Style. I would like to have the “h3” banner in the Details page replicate the look of the tabular report header with a blue ribbon background and the field lettering in white. I realize that a tabular report is just that a table, but where can I view and change the css styles used for the table? I am in hopes that there is a quick HTML/ CSS trick, I can put in the header along with the h3 tags to accomplish table header look. All help and suggestions are Greatly appreciated.
  19. Thank you JayMont, Glad to see I haven't lost all my bookmarks. I just have to edit them, removing the "/?hl=" parameter from the end
  20. I have bookmarked many useful threads from this forum. Except now since the new format to this forum has been implemented, do not work. The link goes to the “Caspio Community Forums” main page instead of the linked thread. for example.. http://forums.caspio.com/index.php/topic/5438-how-do-you-make-a-dropdown-from-a-search-page-filter-a-results-page-without-pressing-search-button/?hl=required#entry17107 Can anyone tell me it these threads still exist or have they been deleted by Caspio when they updated the forums format. I am in hopes that they still exist and I just have to use differant syntax to access the linked threads. Thanks Jim
  21. I have found that if you add a new field to a table, and you have a view associated with the table the field added to the table shows in the view without the “Include field in View” box checked. If you go into the view and navigate to “Field Properties”, you will find your newly added field at the bottom of the list, select it, then check the “Include field in View” check box under field options.
  22. I have experienced this problem before. The field (as you pointed out) needs to be editable for CB to be able to work with the field. The work around I used was to make the field editable, then hide it from displaying. Put the parent field you would like to be hidden between two HTML Blocks. Then in the first HTML Block insert <table style="display:none;"> then close the HTML table tag in the following HTML block </table>. This allows CB to perform operations on the parent field and hides it from displaying on the datapage.
  23. Thank you for your response MayMusic, along with your suggestion I found the procedure to place the submit button at the end of the row in the thread titled “Move Submit Button In-Line With Text Fields?." http://forums.caspio.com/index.php?/topic/4803-move-submit-button-in-line-with-text-fields The virtual fields are hidden by condition rule within the web form. For example, Virtual1 is a dropdown of a lookup table that labeled “Search for..” then displays the lookup table items from the “search” field (customers, jobs). Virtual2 is a cascading dropdown from Virtual1 labeled “by..” that displays the search criteria for the “type” value from the cascading parent “search” field. For example if customer is selected in the parent, Virtual2 displays “by” and the lookup table items from the “type” field (last name, phone number, customer ID) in the dropdown. If jobs is selected the dropdown would display (Job Number, City, ZipCode) Ok, now the rest of the virtual elements pass the value of the selection from Virtual2. For example virtual3 displays (autoselect) the values of last_name from the customer table and passes the selected last_name as a parameter on exit, then Virtual4 and 5 with the corresponding values of phone_number and customer_id. With these three virtual elements in section2. Then a conditional rule declaring “if Virtual1 does not contain ‘Customer’ then section2 is hidden, then individual rules stating “if Virtual2 is not ‘last_name make virtual3 hidden, and so on for each individual element. This works great and saves me from having to create individual search forms for customers and jobs and any other search fields put into the search lookup table. As stated earlier I would like to display all elements on the same line (row). Unfortunately there is no option to display sections on the same row. If I remove the sections and show/hide the virtual fields 3 through however many, the cells in the table jump around on the line with each search. I am thinking that I need a JavaScript to grab all displayed elements, and hide all the form elements on the page, then display the previously unhidden elements on a separate line.
  • Create New...