Jump to content

Hastur

Caspio Ninja
  • Content Count

    92
  • Joined

  • Last visited

  • Days Won

    7

Hastur last won the day on December 16 2019

Hastur had the most liked content!

2 Followers

About Hastur

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  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>
×
×
  • Create New...