Jump to content

Vitalikssssss

Caspio Evangelist
  • Content Count

    522
  • Joined

  • Last visited

  • Days Won

    52

Posts posted by Vitalikssssss

  1. Hi @aquintanilla,

    Here is possible way how you can achieve the desired functionality.

    1. Add Virtual field to the form and set a default value URL to which user will be re-directed after submit.

    1dwFGs2.png

    2. Add the following snippet in Datapage Header.

    Make sure you make changes in lines with comment ***Change 

    <script type="text/javascript">
    
    document.addEventListener('DataPageReady', creatBtn);
    
    //
    function creatBtn () {
    // Hides the Virtual field
    const link = document.querySelector("#cbParamVirtual1"); //***Change Virtual1 if needed
    link.style.display = 'none';
    //Create a button element
    const Btn = document.createElement('input');
    Btn.type = 'submit';
    Btn.name = 'customBtn';
    Btn.classList.add('cbSubmitButton');
    Btn.value = 'Custom Button'; //***Change the name of the button here
    Btn.style.background = '#f51212d9'; //***Change color of the button here
    Btn.addEventListener('click', function() { changeURL(link)});
    //Add button next to the default Submit button
    document.querySelector("div.cbSubmitButtonContainer").appendChild(Btn);
    
    }
    
    function changeURL(link){
    //Changes URL link in Virtual field if the user clicks custom button
    link.value = 'https://google.com'; //***Change URL here
    
    }
    
    </script>

    3. Set an action to go to New page after record submit and use Virtual field as a parameter:
    s57Ygdf.png

     

    Hope this helps.

    Regards,

    vitalikssssss

     

  2. Hi @ahmedramadan,

    Perhaps you may try the following code snippet:

    <script type="text/javascript">
      
    document.addEventListener('DataPageReady', initGeolocation);
                              
                              
         function initGeolocation()
         {
            if(navigator.geolocation)
            {
               // Call getCurrentPosition with success
               navigator.geolocation.getCurrentPosition(success);
            }
            else
            {
               alert("Sorry, your browser does not support geolocation services.");
            }
         }
    
         function success(position)
         {
    		//Change to EditRecord for an update form
    
    		//Current_Long and Current_Lat should change to reference correct field names
             document.getElementById("InsertRecordLong").value = position.coords.longitude;
             document.getElementById("InsertRecordLat").value = position.coords.latitude;
           	 document.removeEventListener('DataPageReady', initGeolocation);
         }
     </script>   

    Regards,

    vitalikssssss

  3. Hi @NickO,

    It would not be possible to write some generic code which would be easy to tweak, because Datapages with Groupping enabled has difference in HTML structure.

    I have created a sample based on your screenshots and my understanding of the HTML structure. I have added a Total and Aggregation field which would be used as a criteria for hiding.

    The report looks like the following without Javascript:
    LDNYfTE.png

    I have set the criteria in JS code to hide Category name and all rows within a group if Total is less than 70, so the Datapage looks like the following:

    2odRa14.png

    The JavaScript solution has been modified slightly compare to the first version:

    <script type="text/javascript">
    
    document.addEventListener('DataPageReady', hideRows);
    
    function hideRows () {
    
    document.querySelectorAll("td[class*='cbResultSetGroup1LabelCellNumberDate']").forEach(function (el) {
        
    
        if (el.innerHTML < 70) { //replace this value with the one which you would like to set as target
            
            el.parentNode.firstChild.click();
            el.parentNode.style.display = 'none';        
        }
    });
    
    document.removeEventListener('DataPageReady', hideRows);
    
    }
    </script>

    Regards,

    vitalikssssss 

  4. Hi @BFuchs,

    You need to make sure that you select Date and Time type of precision in the filtering settings. 

    WWv3p3C.png

    Also, you need to setup a correct logic for filtering within a range of Date&Time values:

    TCgGHT3.png

    You may use a Submission Form which would pass a parameters from Virtual fields to Report Datapage.

    Submission form should have separate Virtual fields for Date and Time input. Calculated value can be used to concatenate Date and Time input and pass it as a parameter to the next form.

    Finally, you need to create a Report Datapage with predefined filtering criteria which will receive a filtering parameter. 

    Here is an example of these Datapages deployed on single web-page.

    You may also import this example into your account to check it further.

    Hope this helps.

    Regards,

    vitalikssssss

    TT_DATE_TIME_FILTER_1_0_2020-May-15_1247.zip

  5. Hi @Vincent,

    Your data needs to reside in Caspio tables in order to work with it via Datapages.

    You may check this article which explains how you can import your date:

    https://howto.caspio.com/tables-and-views/importing-data/

    You may also consider using REST API for transferring the data from you database into Caspio:

    https://howto.caspio.com/web-services-api/rest-api/

    Hope this helps.

    Regards,

    vitalikssssss

     

  6. Hi @Talmax,

    Here is some information which should help:

    1. You may use the following syntax to receive the parameter in custom elements such as <div> located in Datapage: [@PARAMETER_NAME]

    2. You may use timeout redirection settings if you have authentication enabled.

    8l4vrm5.png

    3. Make sure that you pass the parameter which identifies the record which will be shown.

    e.g. if you try to open below Datapage you would need to pass parameter with a name Record_ID and it should look like the following.

    https://xxxxxxx.caspio.com/dp/xxxxxxx273ac9f6ff0a41199812?Record_ID=3

    w7OA9cz.png

     

    Regards,

    vitalikssssss

     

  7. Hi @NickO,

    It looks like it possible only with Collapsible group  --> Collapsed by default settings enabled:

    bnUllLr.png

    You may use the following JS if you have the same type in your Datapage:

    <script type="text/javascript">
    
    document.addEventListener('DataPageReady', hideRows);
    
    function hideRows () {
    
    document.querySelectorAll("td[class*='cbResultSetGroup1LabelCellNumberDate']").forEach(function (el) {
        
        if (el.innerHTML < 1000) { //replace this value with the one which you would like to set as target
            
            el.parentNode.style.display = 'none';
       
        }
    
    });
    
    document.removeEventListener('DataPageReady', hideRows);
    
    }
    </script>

    Hope it helps.

    Regards,

    vitalikssssss

  8. Hi @NickO,

    I think you need to simply combine the condition for assigning 'Primary' value with OR logic operator.

    Perhaps you should try the following expression:

    CASE
    WHEN 	
    
    		[@calcfield:3] = 2 OR 
    		[@calcfield:4] = 2 OR
    		[@calcfield:5] = 2 OR
    		[@calcfield:6] = 2 OR
    		[@calcfield:7] = 2 OR
    		[@calcfield:8] = 2 OR
    		[@calcfield:9] = 2 OR
    		[@calcfield:10] = 2 OR
    		[@calcfield:11] = 2 OR
    		[@calcfield:12] = 2 OR
      		[@calcfield:13] = 2 OR
    		[@calcfield:14] = 2 OR
    		[@calcfield:15] = 2 OR
    		[@calcfield:16] = 2 OR
     		[@calcfield:17] = 2 THEN 'PRIMARY'
            
    ELSE 'NOT'
    END

    Hope this helps.

    Regards,

    vitalikssssss

  9. Hi @JDEV101,

    I doubt that it would be possible to replicate the same type of filtering but you can get close to it.

    You may look into creating a separate form based on Submission form with Virtual fields which will act as a Search Form by passing parameters to the Report.

    This concept explained in this tutorial video: https://www.youtube.com/watch?v=K3CKFjuSIt4

    You may make you Submission form interactive by using Rules: https://www.youtube.com/watch?v=K3CKFjuSIt4

    Hope this helps.

    Regards,

    vitalikssssss

     

  10. Hi @Empbusk,

    The requested part is actually covered in the following tutorial video.

    You would need to use a Details Datapage along with calculated field in order get the count of number of records. 

    Also, some HTML/CSS will be required to apply box styling of the element.

    Hope this helps.

     

     

×
×
  • Create New...