Jump to content


Caspio Guru
  • Posts

  • Joined

  • Last visited

  • Days Won


Community Answers

  1. CoopperBackpack's post in Counting a field match and sorting by another field value - simple but elusive to me was marked as the answer   
    Hello @roattw,
    As for me, the solution with the Pivot table and the Year field as a Row looks fine. 
    Maybe I missed something in your description, but it seems that there is no need to hard code the Year value in the formula (for example, Year = '2021').
    You may use a parameter instead. 
    SELECT COUNT(EM_FA) FROM Publications WHERE EM_FA = 'YES' AND Year = target.[@field:Year]

    The output:

  2. CoopperBackpack's post in PivotTables: Sorting by Values as Default was marked as the answer   
    Hello @FredFarfadoe,
    I`ve already replied to a similar question in this post: https://forums.caspio.com/topic/18712-sort-by-pivot-table-calcualted-field-value-why-is-counting-field-occurrences-so-hard/
    I also cannot find any workaround, since there is no sorting option on the Pivot table DataPage.
    For example, on the Tabular Report DataPage, we can specify the default sort order for up to 4 fields. 

    Maybe you want to add your suggestions here https://caspio.uservoice.com/forums/164206-caspio-bridge
  3. CoopperBackpack's post in another question about Passing Data From A Virtual Field To A Non-Virtual Field was marked as the answer   
    Hello @innov2e,
    This should work with document.getElementsByName.
    Please note that it returns not a single value, but the NodeList Collection of elements, so to get the value you need to use [0] index:
    So, you may try this code: 
    <script> document.addEventListener('BeforeFormSubmit', function(event) { let virtualField = document.getElementsByName('cbParamVirtual1'); document.querySelector('#EditRecordFieldAA').value = virtualField[0].value; }); </script>  
  4. CoopperBackpack's post in Calculation to change Users url destination on Submit was marked as the answer   
    Hello @Hiperf,
    I would like to add that you need to compare the Yes/No field values with 1 or 0, not with 'Y'/'N'.
    If this is the Submission form, you may add Virtual field -> set to the Calculated value with formula:
    SELECT Property1978 FROM tblProperty WHERE PropertyID = target.[@field:SMNPropertyID]  
    In the second Virtual field use the formula:
    CASE WHEN [@cbParamVirtual1] = 1 THEN 'h.html' ELSE 'i.html' END And add this virtual field 2 as a destination after record submit.
    Maybe this article is helpful https://howto.caspio.com/tech-tips-and-articles/common-customizations/dynamic-redirects-after-form-submission/
  5. CoopperBackpack's post in Calculating Greatest Common Divisor was marked as the answer   
    Hello @Iaron7,
    I am afraid that that there is no ready function in SQL to calculate the greatest common divisor. The solution requires using the loop.
    So, it looks like this is not possible to calculate the GCD in the Calculated Field. You may find supported function in this article https://howto.caspio.com/function-reference/ 
    As an option, it is possible to make this calculation by the Triggered Actions.
    The example of the table design:

    Triggered Action:

    The output:

    You may learn more about Triggered Actions in this article if needed https://howto.caspio.com/tables-and-views/triggered-actions/
    Hope this helps. And maybe other forum members will have other ideas.  
  6. CoopperBackpack's post in Trigger to create for all active field was marked as the answer   
    Hello @Benades,
    This information is helpful. As I understand now,  you need to insert new records (not to update the existing) to the user_history table every time the new record is inserted to the trading_results table.
    Let`s say I have the following user_info table:

    And insert data to the trading_results table: growth - 100, date - 04/15/2021
    I receive the following result:

    The Trigger design:

    Not sure that this is  the result that you are looking for. 
    And if it is the case, maybe some can provide you with more elegant solution. 
  7. CoopperBackpack's post in I need help with rules or conditions in a gallery report. was marked as the answer   
    You are welcome. 
    1) When you select the View, but not the Table to build the DataPage, this solution should work as well.
    You are correct, this is the question of correct field names. 
    For your convenience, please use a Picker icon to select the correct field, because in the View the syntax for the field name is following: Table_Name_Field_Name

    Add Image as a File URL and Checkbox as a String.
    2) Here is the example of the workaround of using Files in the Triggered Action.
  8. CoopperBackpack's post in I need help with rules or conditions in a gallery report. was marked as the answer   
    I am glad to hear that solution works for you.
    We can add style="display:none;" to the paragraph tag to hide Yes/No values.
    Also, we can add the width to the image.
    Therefore, the changes should be done only  in the HTML  block.
    This is the updated code:
    <img class="image-elem" src="[@field:Image/]" width="120"></img> <p class="checkbox-elem" style="display:none;">[@field:Checkbox_field]</p> Please test it and let me know in case you have other concerns.
  9. CoopperBackpack's post in I need help with rules or conditions in a gallery report. was marked as the answer   
    Hello @DavidwDavis,
    It seems, that the result can be achieved with JavaScript.
    Please try to follow these steps:
    1. Go to the Search and Report Wizard - Configure Results Page Fields page, add Header and Footer.
    In the Header add CSS style that hides the image. Do not forget to disable HTML editor on the Advanced tab before pasting the code.
    <style> .u__display-none { display: none; } </style> 2. Do not add the Checkbox field and Image field to your Results page. Instead of this add the HTML block (disable HTML editor) and paste the following code into it:
    <img class="image-elem" src="[@field:Image/]"></img> <p class="checkbox-elem">[@field:Checkbox_field]</p> In this way we add fields` values as parameters. Replace the field names with your local names. 
    3. Paste this snippet of code in the Footer section (disable HTML editor before pasting).
    <script type="text/javascript"> document.addEventListener('DataPageReady', hideImagesHandler); function hideImagesHandler() { var flagArr = document.querySelectorAll('.checkbox-elem'); var imagesArr = document.querySelectorAll('.image-elem'); flagArr.forEach(function(elem, i) { if(elem.innerText === 'No') { imagesArr[i].classList.add('u__display-none'); } }) }; </script> This code adds display:none property for the image if the Checkbox field is not checked. 
    Hope this helps.
    Feel free to update this thread if you have any questions or comments.
  10. CoopperBackpack's post in Need help with an IF THEN statement in a trigger action was marked as the answer   
    Hello @DavidwDavis,
    Please try to use the "not in" comparison type instead of the "not equal".  Also, please delete the TOP 1 from the second Select statement. 
    You may refer to the example on my screenshot.

    Feel free to update this thread in case you have questions.
  • Create New...