Jump to content

kpcollier

Caspio Evangelist
  • Posts

    543
  • Joined

  • Last visited

  • Days Won

    27

Everything posted by kpcollier

  1. I thought there use to be a setting in the DataPage Wizard to toggle that on and off, but I can't find it either. Putting this in the header should make it disappear. <style> .cbRecordCountMessage{ display: none; } </style>
  2. I have an Employee_Table that my employees use to log in to my apps and all of that. These users are broken up into groups - Com - Lead, CS - Lead, Res - Lead are the first 3, and Com - Installer, CS - Installer, Res - Installer are the other 3. I have a Employee Survey table and web form that my Lead's are using to submit performance surveys on the Installers. I am trying to create a report or a list that shows which of the Leads (Com - Lead, CS - Lead, Res - Lead) have NOT submitted a survey yet for any Installers. So, if they are in one of the Lead groups, and their ID number isn't in the Survey table, I would like their name to be added to the report/list. I am not too sure how to go about making this work. Any help is appreciated!
  3. *from 6 years ago. Don't hold your breath.
  4. Yes, it is possible! Below is the html for the button I created on the Popup page. First, I was just going to make this button copy the customerID value to the clipboard so that the user can paste the value into the parent page. I am still using this same button for the workflow. This button (and the script) is in an HTML block on the popup results page. <input id="in[@field:CG_Client_ID]" style="width:1px; opacity:0;"> <div class="tooltip"> <button type="button" id="bt[@field:CG_Client_ID]" class="copyBut"> <span class="tooltiptext" id="myTooltip[@field:CG_Client_ID]">Copy to clipboard</span> Copy </button> </div> Then, for the script, the two window.opener.document lines are the ones that copies the value to the parent page. The tooltip is just a nice little message to the user confirming it was copied. I didn't need to add any script to the parent page. document.getElementById('bt[@field:CG_Client_ID]').addEventListener("click", function(){ document.getElementById('in[@field:CG_Client_ID]').value="[@field:CG_Client_ID]"; window.opener.document.querySelector('input[id^="InsertRecordIG_Sheet_Table_Customer_"]').value = "[@field:CG_Client_ID]"; window.opener.document.querySelector('input[id^="InsertRecordIG_Sheet_Table_Customer_"]').dispatchEvent(new Event('change')); document.getElementById('in[@field:CG_Client_ID]').select(); document.execCommand("copy"); var tooltip = document.getElementById("myTooltip[@field:CG_Client_ID]"); tooltip.innerHTML = "Copied: " + "[@field:Primary_Alias]'s ID"; });
  5. What if I am trying to get a value from a caspio Popup datapage to the caspio Parent datapage? On my submission form, I have a spot for 'Customer ID' with a button next to it. If you click the button, a Tabular Report pops up where the user can search our customer table to find the ID. I am trying to make it so the user can just click on the ID they want - or a button next to it - on the popup tabular report and automatically have that value populate the Customer ID input field on the Parent datapage. Is something like this possible? I am struggling to find anything to help me start this.
  6. You can only have 1 trigger of each 'run-on' type - Update, Insert, or Delete. I usually like to break them up into 3 triggers for their respective type in all of my apps for easier organization. Pretty much, you would create a Trigger that runs on Insert, then you would create a 2nd Trigger that runs on Delete and copy the contents from the Insert trigger over to the Delete trigger. Now if the table has a new record inserted, only the Insert Trigger will go off - and vice versa.
  7. There is not a way to have end user import via a datapage, unfortunately. I also would like this feature. There are a couple alternatives that I tried but didn't really like. This one is using a third party service Or, you could try and get scheduled imports set up if you have Datahub included in your plan. Not sure what plans get it or not. https://howto.caspio.com/tables-and-views/scheduled-import-and-export/scheduled-import-and-export-datahub/ https://howto.caspio.com/tables-and-views/scheduled-import-and-export/scheduled-tasks-datahub/?_ga=2.90172251.1300064615.1628521157-85106091.1627397795
  8. No, I apologize. Between school and my job I do not have time. However, I'll gladly help you here for free. I would recommend @LWSChad if you really need someone else to do this for you. He has helped me a few times on these forums and I know he recently got the Certified Caspio Developer stuff going on.
  9. I was kind of referring to this problem a week or so ago, but the presentation of the problem was poor and some things are different. I have three calculated fields that are being used to sum up the entered quantities of specific items. There are 6 fields each - the user will select the type of 'IG' from the left dropdown and put the quantity that they want in the field to the right of it. In the image below, if 'Alum' was selected and '5' was put in the Qty field, we would start with 5 Alum IGs. Now I need to group together alike 'IGs' and sum their quantities. I have 3 calculated fields to account for the 3 IG types, with this formula (the WHEN clause values are Vinyl = 1, Alum = 2, Wood = 3): CASE WHEN [@field:IG_Sheet_Table_IG1] = "1" THEN [@field:IG_Sheet_Table_IG1_Qty] ELSE 0 END + CASE WHEN [@field:IG_Sheet_Table_IG2] = "1" THEN [@field:IG_Sheet_Table_IG2_Qty] ELSE 0 END + CASE WHEN [@field:IG_Sheet_Table_IG3] = "1" THEN [@field:IG_Sheet_Table_IG3_Qty] ELSE 0 END + CASE WHEN [@field:IG_Sheet_Table_IG4] = "1" THEN [@field:IG_Sheet_Table_IG4_Qty] ELSE 0 END + CASE WHEN [@field:IG_Sheet_Table_IG5] = "1" THEN [@field:IG_Sheet_Table_IG5_Qty] ELSE 0 END + CASE WHEN [@field:IG_Sheet_Table_IG6] = "1" THEN [@field:IG_Sheet_Table_IG6_Qty] ELSE 0 END 1 case statement for each IG/Qty and adding them together. These 3 formulas are making my page insanely slow. I am looking for some help on how to rearrange this formula or how to accomplish this in another way that might help with the load times on my page.
  10. @Joemac I believe the only way to get a photo to go straight into the record is by clicking on the file field 'Choose file' button and then selecting the camera. They would have to navigate to the record and then click on the file field, then take the photo, then click update/submit. When doing this on iPad, it should bring up the option to either upload a file/photo from the gallery, or use the camera to take a picture when you click on the 'Choose File' button. We could probably figure out a simple script to autosubmit once a new image/file is loaded into the file field. We could probably figure out a script to automatically hit the 'Choose file' button as well. Say, if you made a Details page where the user could use a search form to find the correct record, then when the results page loads, the script will automatically hit the file field button. Then the user would just have to select the Camera from the prompt and take the photo. Then maybe use the autosubmit function on change of the file field. Not too sure if that is what you are looking for. But if so, I can start trying to make some scripts work.
  11. What do you mean? Are you trying to create a button that will take users to your social media pages? You can make your own button that you can style yourself that will take the user to whatever pages you want. <a class="sMedia" href="www.YourSocialMediaLink.com">Facebook</a> <style> .sMedia { padding: 4px 5px 4px 5px; color: white; background-color: #4267B2; text-decoration: none; border: 1px solid black; border-radius: 5px; } <style> Or, you can take a look here on the HowTo section. This shows different ways to incorporate social media, like a TweetThis button.
  12. Caspio has free hosting for paid plans as well, but I don't think they really advertise it much. If you have your files ready, you can create a support ticket and they will instruct you on how to send them the files (I believe it is through FileZilla) and then they will get it hosted on a website for you.
  13. Thanks for the reply, @TellMeWhy. Maybe this screenshot will help with the understanding. Alum, Vinyl, and Wood are the three possible values for the IG fields. The dropdown is showing the display field, but the value is either 1, 2, or 3. Then the user puts a value of quantity next to it. If IG #1 is set to Wood, and the Qty is 3, then we know we have 3 wood windows. I'm trying to determine how many of each type of IG we have. So, if IG1 and IG2 were both 'Alum' with Qty of 6, I would have 12 Alum IGs. I will give your approach a try.
  14. Trying to think of other possible options... I've found a couple posts on SO where you can group an object array by one value and sum up the other values. However, I'm not too sure how to get the 'results' properties into my 3 totals fields. This script groups the array by Type and then sums up the Qtys of each. It produces an object ... ex {type: 1, qty: 14}. Now I need to be able to put those values into my virtual fields... var igT = [ {type: ig1v.value, qty: ig1q.value}, {type: ig2v.value, qty: ig2q.value}, {type: ig3v.value, qty: ig3q.value}, {type: ig4v.value, qty: ig4q.value}, {type: ig5v.value, qty: ig5q.value}, {type: ig6v.value, qty: ig6q.value} ]; var result = []; igT.reduce(function(res, value) { if (!res[value.type]) { res[value.type] = { type: value.type, qty: 0 }; result.push(res[value.type]) } res[value.type].qty += +value.qty; return res; }, {}); console.log(result) });
  15. I have 12 fields in total - IG1 - IG6, which are dropdown fields and IG1_Qty - IG6_Qty - number input fields, they coincide with each other. The IG fields have 3 possible values - 1, 2, or 3. The Qty field is a number field to state how many of those IGs they want. In Example, the user would select '2' for IG1 and put in 4 for IG1_Qty, showing that they want 4 of the type 2 IGs. Now, the sum field for type 2 IGs would show 4. If we went on to give IG2's value to 2 as well, with a quantity of 1, then the sum field for type 2 IGs would show 5 (4 + 1). Essentially, I want to sum up the selections for the 3 possible IG dropdown values with the quantities selected for each. I was able to create an array with the 6 IG dropdown fields and count how many of each possible values were selected. However, adding in the Quantities for each IG into that number is where I ran into the problem, so I had to change the script entirely. This is my latest try: var ig1v = document.querySelector('select[id^="InsertRecordIG_Sheet_Table_IG1_"]'); //IG1 field - possible values are 1, 2, or 3 var vf1 = document.getElementById("cbParamVirtual22"); //This is where the sum value for IG Type 1 will go var vf2 = document.getElementById("cbParamVirtual23"); //Type 2 var vf3 = document.getElementById("cbParamVirtual21"); //Type 3 var ig1q = document.getElementById("InsertRecordIG_Sheet_Table_IG1_Qty"); //How many of the selected IG type var addNew1 = true; vf1.value = 0; //Setting the value to 0 so that the other calculated fields in the form don't load with an error. //This first eventListener/function is to automatically give 'Qty' a value if the IG dropdown isn't null anymore. This is just to automatically set Qty to 1 instead of blank when the user selects an IG value for the first time - UX document.querySelector('select[id^="InsertRecordIG_Sheet_Table_IG1_"]').addEventListener("change", function () { if (addNew1){ ig1q.value = 1; addNew1 = false; } ig1q.dispatchEvent(new Event('change')); }); //This function is what I am using to count the number of each IG value. If IG = 1, then add the IG1_Qty to the type 1 sum field (vf1), etc. document.getElementById('InsertRecordIG_Sheet_Table_IG1_Qty').addEventListener("change", function calcGroups1(){ if (ig1v.value == 1){ vf1.value = +vf1.value + +ig1q.value; } else if (ig1v.value == 2){ vf2.value = +vf2.value + +ig1q.value; } else if (ig1v.value == 3){ vf3.value = +vf3.value + +ig1q.value; } }); I have 6 of both of those functions for each IG field. Please forgive the ugly JS, I am sure there is a much better way to write this, but I have no clue how. The problems I am now having is that the Sum fields (vf1-vf3) are adding every change. See how the first function in the script sets Qty to 1 when the corresponding IG field is given a value - this is correctly being added to the vf1 totals field. But, if I change the quantity from 1 to another number, it adds it instead of just changing the value. So, when the Qty field is automatically set to 1, and then you change it to 4, the vf1 totals field would show 5 instead of 4. If you changed the 5 to a 4, it would show 9. Also, if the IG type is changed, the totals values are not updated for the previously selected value. Say I have IG1 = 1, Qty = 4. Now VF1 (sums of 1) will show 4. But, if I change IG1 = 2 with the same Qty, now VF2 will show 4, but VF1 will also still show 4. I'm not sure how to go about deleting the value from the previous sum field when the IG type is changed, or when the quantity is changed. I apologize for this being so confusing, but it is making my head turn into mush and I could use any of the help I can get.
  16. Let me see if I can replicate the issue and I'll let you know if I find a solution.
  17. I replied to your post on that forum. Head over there, read through my little write up and if you still have questions, ask on that one and I'll gladly help you through it.
  18. Hi @amillernwg. First off, do you have a user table that stores the information for your users? And is your submission form running off of a different table that has a date field? If so, your going to need to add a virtual field to your submission form. You'll set the virtual field to a Calculated Value element. Use the code below in the calculated field where TABLENAME is the name of your table, and DateFIELD is the name of your date field your table: STUFF( (SELECT ' , ' + CAST (FIELDNAME AS nvarchar) FROM TABLENAME WHERE DATEFIELD = target.[@field:DateFIELD] FOR XML PATH ('')) , 1, 2, '') Then, on the same submission form, you will want to click on the Insert Picker and insert a Header & Footer. Go to Footer, click Advanced, and uncheck 'Enable HTML editor'. Then, go back to the Standard tab, and insert this code: <script> document.querySelector("input[name='cbParamVirtual1']").addEventListener("change", function(event){ var d2 = document.getElementById("cbParamVirtual2"); var a= document.querySelector("input[name='cbParamVirtual1']").value; for (var i=0; i<d2.length; i++) { if (a.includes(d2.options[i].value)){ d2.options[i].remove(); } else { d2.options[i].style.display = "block"; } } }); </script> The only thing you need to change is the 'cbParamVirtual2'. Here you will put the name of your user field. You might need to put 'InsertRecordFIELDNAME' since it is a submission form, where FIELDNAME is the name of your user field.
  19. Hi @amillernwg, I just recently went through this workflow. This post should help you achieve it.
  20. If you have multiple datapages on one webpage, the alert might go off for all of them when loaded. If this is the case, you'll need to modify the script a bit. document.addEventListener('DataPageReady', function (event) { if (event.detail.appKey == 'MY_DATAPAGE_APPKEY') { setTimeout(function(){ alert("Please save your work."); }, 1800000); } }); You can find the DataPage's Appkey for 'MY_DATAPAGE_APPKEY' in the 'Properties' section of the datapage in the Caspio Bridge.
  21. This may not be the best way, but it should work. Put this in the footer of your datapage. The '1800000' is 30 minutes in milliseconds. <script> document.addEventListener("DataPageReady", function(){ setTimeout(function(){ alert("Please save your work."); }, 1800000); }); </script>
  22. What do you mean by autocorrected? I currently have this workflow on my report and it is working.
  23. This is working, however I'm inclined to believe there's got to be a better way to write this, instead of having eventListeners on each field doing the same exact function. Nonetheless, it's working. var ig1v = document.querySelector('select[id^="InsertRecordIG_Sheet_Table_IG1_"]'); var ig2v = document.querySelector('select[id^="InsertRecordIG_Sheet_Table_IG2_"]'); var ig3v = document.querySelector('select[id^="InsertRecordIG_Sheet_Table_IG3_"]'); var ig4v = document.querySelector('select[id^="InsertRecordIG_Sheet_Table_IG4_"]'); var ig5v = document.querySelector('select[id^="InsertRecordIG_Sheet_Table_IG5_"]'); var ig6v = document.querySelector('select[id^="InsertRecordIG_Sheet_Table_IG6_"]'); var vf1 = document.getElementById("cbParamVirtual23"); var vf2 = document.getElementById("cbParamVirtual22"); var vf3 = document.getElementById("cbParamVirtual21"); document.querySelector('select[id^="InsertRecordIG_Sheet_Table_IG1_"]').addEventListener("change", function calcGroups(){ const numberList = [ig1v.value, ig2v.value, ig3v.value, ig4v.value, ig5v.value, ig6v.value]; const counts = {}; for (const num of numberList) { counts[num] = counts[num] ? counts[num] + 1 : 1; }; vf1.value = (counts[2] === undefined) ? 0 : counts[2]; vf2.value = (counts[1] === undefined) ? 0 : counts[1]; vf3.value = (counts[3] === undefined) ? 0 : counts[3]; console.log(counts[3], counts[2], counts[1]); }); document.querySelector('select[id^="InsertRecordIG_Sheet_Table_IG2_"]').addEventListener("change", function calcGroups(){ const numberList = [ig1v.value, ig2v.value, ig3v.value, ig4v.value, ig5v.value, ig6v.value]; const counts = {}; for (const num of numberList) { counts[num] = counts[num] ? counts[num] + 1 : 1; }; vf1.value = (counts[2] === undefined) ? 0 : counts[2]; vf2.value = (counts[1] === undefined) ? 0 : counts[1]; vf3.value = (counts[3] === undefined) ? 0 : counts[3]; console.log(counts[3], counts[2], counts[1]); }); document.querySelector('select[id^="InsertRecordIG_Sheet_Table_IG3_"]').addEventListener("change", function calcGroups(){ const numberList = [ig1v.value, ig2v.value, ig3v.value, ig4v.value, ig5v.value, ig6v.value]; const counts = {}; for (const num of numberList) { counts[num] = counts[num] ? counts[num] + 1 : 1; }; vf1.value = (counts[2] === undefined) ? 0 : counts[2]; vf2.value = (counts[1] === undefined) ? 0 : counts[1]; vf3.value = (counts[3] === undefined) ? 0 : counts[3]; console.log(counts[3], counts[2], counts[1]); }); document.querySelector('select[id^="InsertRecordIG_Sheet_Table_IG4_"]').addEventListener("change", function calcGroups(){ const numberList = [ig1v.value, ig2v.value, ig3v.value, ig4v.value, ig5v.value, ig6v.value]; const counts = {}; for (const num of numberList) { counts[num] = counts[num] ? counts[num] + 1 : 1; }; vf1.value = (counts[2] === undefined) ? 0 : counts[2]; vf2.value = (counts[1] === undefined) ? 0 : counts[1]; vf3.value = (counts[3] === undefined) ? 0 : counts[3]; console.log(counts[3], counts[2], counts[1]); }); document.querySelector('select[id^="InsertRecordIG_Sheet_Table_IG5_"]').addEventListener("change", function calcGroups(){ const numberList = [ig1v.value, ig2v.value, ig3v.value, ig4v.value, ig5v.value, ig6v.value]; const counts = {}; for (const num of numberList) { counts[num] = counts[num] ? counts[num] + 1 : 1; }; vf1.value = (counts[2] === undefined) ? 0 : counts[2]; vf2.value = (counts[1] === undefined) ? 0 : counts[1]; vf3.value = (counts[3] === undefined) ? 0 : counts[3]; console.log(counts[3], counts[2], counts[1]); }); document.querySelector('select[id^="InsertRecordIG_Sheet_Table_IG6_"]').addEventListener("change", function calcGroups(){ const numberList = [ig1v.value, ig2v.value, ig3v.value, ig4v.value, ig5v.value, ig6v.value]; const counts = {}; for (const num of numberList) { counts[num] = counts[num] ? counts[num] + 1 : 1; }; vf1.value = (counts[2] === undefined) ? 0 : counts[2]; vf2.value = (counts[1] === undefined) ? 0 : counts[1]; vf3.value = (counts[3] === undefined) ? 0 : counts[3]; console.log(counts[3], counts[2], counts[1]); });
  24. I've got 3 calculated fields with case statements that are being used to sum up the number of occurrences of particular values from 6 dropdowns. I believe this is a big reason for the slowness of my datapage. As it is now, every time one of the values is changed, all three of the case statements go off. Each of the 6 dropdowns have 3 possible values - 1, 2, or 3. Hence, 3 calculated fields for the sums of each possible value. You can see how this would take a while to load with each change in value, as it runs through 6 case statements for each of the 3 calc fields before a final result is produced. CASE WHEN [@field:IG_Sheet_Table_IG1] = '2' THEN 1 ELSE 0 END + CASE WHEN '[@field:IG_Sheet_Table_IG2]' = '2' THEN 1 ELSE 0 END + CASE WHEN '[@field:IG_Sheet_Table_IG3]' = '2' THEN 1 ELSE 0 END + CASE WHEN '[@field:IG_Sheet_Table_IG4]' = '2' THEN 1 ELSE 0 END + CASE WHEN '[@field:IG_Sheet_Table_IG5]' = '2' THEN 1 ELSE 0 END + CASE WHEN '[@field:IG_Sheet_Table_IG6]' = '2' THEN 1 ELSE 0 END I am looking for any advice on how to do this differently... I have been unsuccessful with javascript as well, but I am not the best at that. With the script below, I haven't got to the part where I'll add the calculated value to a field. I am just using console.log to see if it works first. I am getting an error that it can't read the eventListener of null. After some digging, I am thinking it is because of the querySelector, but I am not too sure what is going on. var ig1v = document.querySelector('select[id^="InsertRecordIG_Sheet_Table_IG1_"]'); var ig2v = document.querySelector('select[id^="InsertRecordIG_Sheet_Table_IG2_"]'); var ig3v = document.querySelector('select[id^="InsertRecordIG_Sheet_Table_IG3_"]'); var ig4v = document.querySelector('select[id^="InsertRecordIG_Sheet_Table_IG4_"]'); var ig5v = document.querySelector('select[id^="InsertRecordIG_Sheet_Table_IG5_"]'); var ig6v = document.querySelector('select[id^="InsertRecordIG_Sheet_Table_IG6_"]'); function calcGroups(){ const numberList = [ig1v.value, ig2v.value, ig3v.value, ig4v.value, ig5v.value, ig6v.value]; const counts = {}; for (const num of numberList) { counts[num] = counts[num] ? counts[num] + 1 : 1; }; console.log(counts[3], counts[2], counts[1]); }; ig1v.document.addEventListener("change", calcGroups);
  25. The following should delete the matching iD and the extra ' ;' from the list if there is one. if(list.value == '' && joinList.value == 'Y'){ list.value = iD; } else if(list.value != '' && joinList.value == 'Y'){ list.value = list.value + '; ' + iD; } else if (joinList.value == 'N'){ list.value = list.value.replaceAll('; ' + iD, ''); list.value = list.value.replace(iD, ''); }
×
×
  • Create New...