Jump to content

Hastur

Caspio Guru
  • Posts

    142
  • Joined

  • Last visited

  • Days Won

    14

Everything posted by Hastur

  1. Hello @walkerc You need to insert the following code into the footer of your result set: <script type="text/javascript"> function inputHandler(event) { if (document.getElementById('clicked')) { let clickedElem = document.getElementById('clicked'); clickedElem.click(); clickedElem.id = ""; } event.target.id = "clicked"; } function assignEvent() { let elems1 = document.querySelectorAll('tr[data-cb-name="group1"]'); let elems2 = document.querySelectorAll('span[data-cb-name="switch-group-state-btn"]'); for(elem of elems1) { elem.addEventListener('click', inputHandler); }; for(elem of elems2) { elem.remove(); }; document.removeEventListener('DataPageReady', assignEvent); } document.addEventListener('DataPageReady', assignEvent); </script> Prior to insert the code, you need to disable the HTML editor of the header. You can do this in the Advanced section of the footer.
  2. @JanineB Hi! Here is the up to date formula considering new Timestamp function: DateDiff(year, [@field:Date], SysUTCDateTime()) - CASE WHEN SysUTCDateTime() > DateAdd( year, DateDiff(year, [@field:Date], SysUTCDateTime()), [@field:Date] ) THEN 1 ELSE 0 END
  3. Hello @Emilaos Can you provide some more details about your workflow?
  4. Hello @Libby To implement such a workflow, you should add additional criteria to your search field Then you need to adjust the logic of search
  5. Hello @EmmePGN You should use double equal character in if statement to compare: <script> function hideFieldsHandler(event) { let targetInput = document.getElementById("EditRecordCertification"); let firstField = document.getElementById("EditRecordFrequencyA").parentNode.parentNode; let secondField = document.getElementById("EditRecordFrequencyB").parentNode.parentNode; if (event.target.value == 300) { firstField.style.display = "none"; secondField.style.display = ""; } else if (event.target.value == 500) { secondField.style.display = "none"; firstField.style.display = ""; } } function changeHandler() { document.getElementById('EditRecordCertification').addEventListener('change', hideFieldsHandler); let firstField = document.getElementById("EditRecordFrequencyA").parentNode.parentNode; let secondField = document.getElementById("EditRecordFrequencyB").parentNode.parentNode; firstField.style.display = "none"; secondField.style.display = "none"; document.removeEventListener('DataPageReady', changeHandler); } document.addEventListener('DataPageReady', changeHandler); </script>
  6. Hello @Morris To implement such a workflow you need to create the table with such a structure: Question_ID Rating 1 1 1 2 1 3 2 1 2 2 2 3 3 1 3 2 3 3 Then you may create additional calculated field in the Tabular Report and use the following formula : SELECT COUNT(User_ID) FROM Survey_Table WHERE Questions_ID = target.[@field:Questions_ID] AND Rating = target.[@field:Rating] Change the names of the table and fields according to the names in your account.
  7. Hello @TDNgromak Under the hood, Caspio uses the Highcharts library to render charts. To change the layout of the Chart you need to use Highcharts.update() method. Here is the example - https://www.highcharts.com/demo/chart-update You may use the documentation of Highcharts to find the appropriate property to change the align of the columns. Here is the example of JS code on how to change colors of the donut chart: <script type="text/javascript"> document.addEventListener('DataPageReady', chartUpdateHandler) function chartUpdateHandler(event) { var cleaner = function(interv) { clearInterval(interv); } let interv = setInterval(() => { let colors = []; for(let i = 0; i < Highcharts.charts[0].series[0].data.length; i++) { if(Highcharts.charts[0].series[0].data[i].name === "Value_1") { colors.push("#00FF00"); } else if (Highcharts.charts[0].series[0].data[i].name === "Value_2") { colors.push("#FF0000"); } } if (!!Highcharts) { Highcharts.charts[0].update({ plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', colors: colors } } }); cleaner(interv); } }, 200); } </script>
  8. Hello @EmmePGN You can implement such a logic using both Rules and JS. Use Rule to make appropriate fields as required. Here is the example of the code you may add to the footer of the DataPage: <script> function hideFieldsHandler(event) { let targetInput = document.getElementById("EditRecordDropdown_Name"); let firstField = document.getElementById("EditRecordField_Name").parentNode.parentNode; let secondField = document.getElementById("EditRecordField_Name").parentNode.parentNode; if (event.target.value == '1') { firstField.style.display = "none"; secondField.style.display = ""; } else if (event.target.value == '2') { secondField.style.display = "none"; firstField.style.display = ""; } } function changeHandler() { document.getElementById('EditRecordDropdown_Name').addEventListener('change', hideFieldsHandler); let firstField = document.getElementById("EditRecordField_Name").parentNode.parentNode; let secondField = document.getElementById("EditRecordField_Name").parentNode.parentNode; firstField.style.display = "none"; secondField.style.display = "none"; document.removeEventListener('DataPageReady', changeHandler); } document.addEventListener('DataPageReady', changeHandler); </script> Parts needs to be changed: 1. Dropdown_Name and Field_Name parts according to the names of the fields you use in your DataPage. 2. "1" and "2" values in the IF statement according to values of your Dropdown field. Also, you need to disable the HTML editor of the footer before you insert the code. You can find the Example here.
  9. Hello @Kimberly I have tested this solution in a few Browsers and it works fine. Can you try this code? <input type="reset" value="Reset" /> Also, you need to disable the HTML editor. You can find this adjustment in the Advanced section of the HTML block. There is a checkbox named "Enable HTML editor". You need to uncheck it.
  10. @DesiLogi You can apply the same logic as I did in the example CASE WHEN resul >= 1 AND resul <= 15 THEN 0.25 WHEN resul >= 16 AND resul <= 30 THEN 0.5 . . . END
  11. Hello @Bleman You can use this example to implement such a comparison.
  12. Hello @DesiLogi Here is the example of the formula you may use: CAST((SUBSTRING( CAST([@field:Numb_Val] AS nvarchar), 0, CHARINDEX('.', CAST([@field:Numb_Val] AS nvarchar)))) AS float) + CASE WHEN CAST( ('0'+ SUBSTRING(CAST([@field:Numb_Val] AS nvarchar), CHARINDEX('.', CAST([@field:Numb_Val] AS nvarchar)), 100)) AS float) < 0.125 THEN 0 WHEN CAST( ('0'+ SUBSTRING(CAST([@field:Numb_Val] AS nvarchar), CHARINDEX('.', CAST([@field:Numb_Val] AS nvarchar)), 100)) AS float) >= 0.125 AND CAST( ('0'+ SUBSTRING(CAST([@field:Numb_Val] AS nvarchar), CHARINDEX('.', CAST([@field:Numb_Val] AS nvarchar)), 100)) AS float) < 0.375 THEN 0.25 WHEN CAST( ('0'+ SUBSTRING(CAST([@field:Numb_Val] AS nvarchar), CHARINDEX('.', CAST([@field:Numb_Val] AS nvarchar)), 100)) AS float) >= 0.375 AND CAST( ('0'+ SUBSTRING(CAST([@field:Numb_Val] AS nvarchar), CHARINDEX('.', CAST([@field:Numb_Val] AS nvarchar)), 100)) AS float) < 0.625 THEN 0.5 WHEN CAST( ('0'+ SUBSTRING(CAST([@field:Numb_Val] AS nvarchar), CHARINDEX('.', CAST([@field:Numb_Val] AS nvarchar)), 100)) AS float) >= 0.625 AND CAST( ('0'+ SUBSTRING(CAST([@field:Numb_Val] AS nvarchar), CHARINDEX('.', CAST([@field:Numb_Val] AS nvarchar)), 100)) AS float) < 0.875 THEN 0.75 WHEN CAST( ('0'+ SUBSTRING(CAST([@field:Numb_Val] AS nvarchar), CHARINDEX('.', CAST([@field:Numb_Val] AS nvarchar)) , 100)) AS float) >= 0.875 THEN 1 END In this formula, the DataType of the field you want to round is Number. You need to change "[@field:Numb_Val]" part of the formula according to the name of the field you use.
  13. Hello @Tr0Jan To embed Caspio DataPages you can use JavaScript, to create <script> element, define the "src" attribute and then append it to your page. Here is the example: const elem = document.createElement('script'); elem.type = 'text/javascript'; elem.src = 'https://deploy_URL/'; document.GET_NEEDED_ELEMENT.appendChild(elem);
  14. Hello @DesiLogi To implement this you may change your table design. Example: You have two tables. Table 1 is the parent table and Table 2 is the child table. Unique id's of the first table are "a", "b" and "c". Unique id's of the first table are "1", "2", "3", "4", "5", "6" and "7". You need to create third table to connect these tables. example: tabe1_id table2_id a 1 a 2 a 5 b 3 b 4 b 6 c 2 c 6 c 7 Then, you may create a View to gather all the data and use this View as the source for your Reports. Here you can find helpful information related to Many-to-Many relationship -
  15. Hello @roattw You can set the Date value once and copy the value into second hidden field using JS. Here is the example based on two Virtual fields: <script> function copyDate(event) { let targetInput = document.getElementById('cbParamVirtual2'); targetInput.value = event.target.value; } function copyDateHandler() { document.getElementById('cbParamVirtual1').addEventListener('change', copyDate); document.removeEventListener('DataPageReady', copyDateHandler); } document.addEventListener('DataPageReady', copyDateHandler); </script>
  16. Hello @roattw Try to use this code: <script> function first() { var date = document.getElementById('cbParamVirtual1').value; if(date == "") { date = "1/1/2011"; } var hour = document.getElementById('cbParamVirtual2').value; if(hour =="") { hour="00"; } var minute = document.getElementById('cbParamVirtual3').value; if(minute == "") { minute = "00"; } document.getElementById('InsertRecordTIME1').value = date + " " + hour + ":" + minute; } function second() { var date2 = document.getElementById('cbParamVirtual4').value; if(date == "") { date = "1/1/2011"; } var hour2 = document.getElementById('cbParamVirtual5').value; if(hour =="") { hour="00"; } var minute2 = document.getElementById('cbParamVirtual6').value; if(minute == "") { minute = "00"; } document.getElementById('InsertRecordTIME2').value = date + " " + hour + ":" + minute; } document.getElementsByName('Submit')[0].addEventListener('mouseover', first); document.getElementsByName('Submit')[0].addEventListener('mouseover', second); </script> You should add new events using "addEventListener()" method. In other case, you will just overwrite the existing one.
  17. Hello @Leon13 I think that the best way is to divide this big list into fields with related categories. Example: 1. Field - OS, values of the list/string - Windows, LINUX 2. Field - Type, values of the list/string - Appliance... 3. Location - Bogota... In this case, you will have a couple of form elements for your categories with related values.
  18. Hello @Dimitri It is possible using additional JS code. First of all, you should use custom link, like this: <a href="" id="customLink">LINK</a> You can insert it into HTML block of the submission form. Then you should add the following code to change the href of your custom link. In the example, I use the Virtual1 field as the source with the link value: <script type="text/javascript"> function changeLink(event) { document.querySelector('#customLink').href = event.target.value; } function changedHandler() { document.querySelector('input[name="cbParamVirtual1"]').addEventListener('change', changeLink); document.removeEventListener('DataPageReady', changedHandler); } document.addEventListener('DataPageReady', changedHandler); </script> Please note that the id of your link should be the same as querySelector() argument in the someAlert() function.
  19. Hi @Elderberg This is not related to cache or cookies. This is the default behavior of "DataPageReady" event. You need to clean this event after executing. Also, you need to define functions out of event listener to increase the performance. Here is the example of the code: <script> function someFunc() { alert("Hello World"); document.removeEventListener("DataPageReady", someFunc); } document.addEventListener('DataPageReady', someFunc); </script>
  20. Hello @DesiLogi You can display using the URL in the Text255 only if you have one link in the field. If you have more links, you need use JS to parse the value of the Text field, define each link and use them to append new <img /> tags with the appropriate values of links as many times as many links you have in the field.
  21. Hello @BFuchs It seems like the Tabular report with inline-insert and inline-edit functions enabled is a good fit for you! You can enable these features in the DataPage Wizard on the step named "Results Page Editing Option".
  22. Hello @Ashfia You can implement such a workflow using additional Yes/No field in the survey table and Task feature. Also, the survey table should have a field with the date when the survey has been sent to a client. Within your submission form, you should add the Yes/No field as a hidden one. It should be "checked" by default. Then, you may create a Task that will compare the sent date with the current date and will send the reminder Email if these dates are equal and if the checkbox is not checked (so it means that survey was not submitted).
  23. Hello @CarloLaPiaja As your questions are very product-specific, I think it is better to open a ticket to get answers to your questions. You can do it here - https://www.caspio.com/support/
  24. Hello @NickO To make links from the labels of the second level of grouping, please use this code: <script> function appendLink(elems) { let detailsLink = "https://account_id.caspio.com/dp/datapage_app_key?param="; for(let elem of elems) { let link = document.createElement('a'); link.href = detailsLink + '?param=' + elem.innerText; link.innerText = elem.innerText; link.style.cssText = "color: white; font-size: 12px; font-family: Arial, sans-serif; font-weight: normal;"; elem.innerText = ''; elem.appendChild(link); } }; document.addEventListener('DataPageReady', appendLink(document.querySelectorAll('td[data-cb-name="groupLabelCell2"]'))); </script> As I mentioned before, insert this code into the Footer of the result set. Do not forget to disable HTML editor of the Footer in the Advanced options.
  25. Hello @NickO You need to use additional JS code to convert your Grouping labels to links. You need to insert this code into the Footer of the result set. Also, you need to disable HTML editor of the Footer in the Advanced options. Here is the code: <script> function appendLink(elems) { let detailsLink = "https://account_id.caspio.com/dp/datapage_app_key?param="; for(let elem of elems) { let link = document.createElement('a'); link.href = detailsLink + elem.childNodes[0].innerText; link.innerText = elem.childNodes[0].innerText; link.style.cssText = "color: white; font-size: 12px; font-family: Arial, sans-serif; font-weight: normal;"; elem.childNodes[0].innerText = ''; elem.childNodes[0].appendChild(link); } }; document.addEventListener('DataPageReady', appendLink(document.querySelectorAll('tr[data-cb-name^="group"]'))); </script> The idea is to pass the value of the label as the parameter and get the information related to it. In your case, you may pass the name of state. To do that, you need to change this part of code: let detailsLink = "https://account_id.caspio.com/dp/datapage_app_key?param="; // https://account_id.caspio.com/dp/datapage_app_key - web link where you have your details DataPage // param - the name of the parameter you use in search criteria To get familiar with passing parameters please check this page - https://howto.caspio.com/parameters/parameters-as-query-string-values/ Let me know if you have any questions.
×
×
  • Create New...