Jump to content

Aether

Caspio Rockstar
  • Posts

    342
  • Joined

  • Last visited

  • Days Won

    22

Reputation Activity

  1. Thanks
    Aether reacted to futurist in A button that changes the background color (random color) of each record in Gallery Report DataPage   
    Hi,
    Just wanna share this script I made that changes the background color of each record in a Gallery Report DataPage when clicking the button.
    For the button:
    <button onclick="RandomColor()">Try it</button>
     
    For the function that's responsible for changing the colors (For this one, there is no fixed set of color because this makes use of randomizers for setting the color code, so all colors possible can show up):
    <script>
    function RandomColor() {
     var x = document.querySelector("section[class*='cbColumnarReport cbReportSection']");
      x.querySelectorAll('div > div:nth-child(1)').forEach(e => e.style.backgroundColor = '#' + ('0'+(Math.random()*255|0).toString(16)).slice(-2) + ('0'+(Math.random()*255|0).toString(16)).slice(-2) + ('0'+(Math.random()*255|0).toString(16)).slice(-2))
    }
    </script>
     

     
    Sample DP: https://c1hch576.caspio.com/dp/db26a00071c83c69ac9947d1bfd9
     
    Alternatively, if you only wish to have a predefined set of colors to choose from, you can use this (simply change the colors in the array to your liking):
    <script>
    var colors = ["red", "blue", "green","orange","yellow","violet","lightblue","cyan","magenta"];

    function RandomColor() {

     var x = document.querySelector("section[class*='cbColumnarReport cbReportSection']");
      x.querySelectorAll('div > div:nth-child(1)').forEach(e => e.style.backgroundColor = colors[Math.floor(Math.random() * colors.length)])
    }
    </script>

     
    Sample DP: https://c1hch576.caspio.com/dp/db26a000574d59f66468479b955a
    Hope this helps!
  2. Thanks
    Aether reacted to Elderberg in Inline edit only in certain circumstances   
    Just leaving this here ...  
     
    <script> document.addEventListener('DataPageReady', function(event) { function hideControlsForPerson() { var table = typeof document.getElementsByClassName("cbResultSetTable" + event.detail.uniqueSuffix)[0] == "undefined" ? document.getElementsByClassName("cbResultSetTable")[0] : document.getElementsByClassName("cbResultSetTable" + event.detail.uniqueSuffix)[0]; // Find the index of the last column, which happens to be the inline edit/delete var total_num_columns = table.rows[0].cells.length; var controlsColumnIndex = total_num_columns - 1; //position of the column with inline edit/delete // Find the index position of the column by searching the column's label row = table.rows[0]; var i; var KeyColumnIndex; for (i = 0; i < total_num_columns; i++) { if (row.cells[i].textContent == 'Label_of_Target_Field') { KeyColumnIndex = i; i = total_num_columns; // this is essentially to exit the loop } } // Iterating through rows and hiding Content for (var i = 1, row; row = table.rows[i]; i++) { if (row.cells.length > KeyColumnIndex && row.cells[KeyColumnIndex].textContent !== '[@authfield:Name]') { row.cells[controlsColumnIndex].style = "display:none;" } } } hideControlsForPerson( ); }); </script>  
    Note:  " row.cells.length > KeyColumnIndex "  was added to the if statement to protect against an uncaught TypeError that happens if using a date rollup or other field grouping. 
     
     
  3. Like
    Aether got a reaction from kpcollier in Link to Redirect in Google Map   
    Hello @FinTheHuman,
    Yes, this is possible. You may try this JavaScript code that will get your record's geolocation and PIN it to the Google Map itself.
    <p><div id="Location"></div></p> <script type="text/javascript" src="https://code.jquery.com/jquery-latest.min.js"></script> <script type="text/javascript"> $("#Location").html('<a href=" '+ 'https://www.google.com.ph/maps/dir/' + '[@field:Latitude],[@field:Longitude]/' + ' " > Get the Coordinate in Google Map </a>'); </script>
    You can test it out here: https://c1abv183.caspio.com/dp/48276000a06f576279544ea0bc7d
     
    I hope this helps!  
  4. Like
    Aether got a reaction from kpcollier in Importing/Exporting spreadsheet with list-DataType   
    Hello @IamGroot,
    Just wanted to inform you, I found a way to export/import a table/database with List-DataType value inside it. 
    1. Change the DataType to "Text(255) field" and Export it.
    2. And in your Excel file, make sure that the value for the List-String field is comma separated like this: (Item1,Item2,Item3,Item4, etc.)
    3. Proceed with the import as usual. After successfully importing your file. Go to your Table and to the Table Design.
    4.  Change the "Text(255) Field" (The one we changed in step 1) back to List-String DataType.
    5. Then it will just return the way it was. If you want to export it (reapeat step(1)).
    I hope this helps  
    ~WatashiwaJin~
  5. Like
    Aether reacted to ServiceBreez in Grouping text area field   
    OK this worked as suggested, thank you!
    One thing to note for others that may go down this path, it cuts off at 255 characters.  So grouping is possible (yay!), but unfortunately displaying the full text area is limited to 255.
     
    Thanks again @WatashiwaJin
  6. Like
    Aether reacted to NiceDuck in submission form. send email to different users depending on the value of a certain field in the submission form.   
    Hello
    I want to share something with you guys again. 
    Back then when I only have an 'explore plan', I'm using this workflow to send acknowledgement/notification emails on different persons base on a value of a field in my submission form.

    My workflow back then is I have a submission form for job applicants.  I want to send an email to a certain member of my company depending on which position the applicant is app laying.  for example.
    If the applicant is applying for a staff position, there will be an email an email send to staff manager, 
    If the applicant is applying for an agent position, there will be an email an email send to agent manager. 
    etc...
    This could easily be done via trigger but since it was unavailable on explore plans. This is what I did. 
     
    First I made a lookup table containing the emails of the designated managers where I used the job they are managing as a unique field. 
    Then on my submission form. I made a virutal field and  set it as a cascading dropdown that is using the field for the position the user is applying for as a parent field and used the table containing the emails of the managers as a lookup table. I enveloped this virtual field with html blocks with html codes for hiding fields. please see this documentation for reference : https://howto.caspio.com/tech-tips-and-articles/common-customizations/how-to-hide-fields-in-datapages/ and https://howto.caspio.com/datapages/datapage-components/cascading-elements/ .
    Now that it was hidden, we will now proceed to the messaging options.  It is up to you to chose  if you want an Notification emails or Acknowledgement emails. As I check It works with any of them as long as you are going to use the virtual field with cascading value as the field reference for email. 
     
    It will now send an email on different person depending on what job the user is applying to.
    I hope it helps anyone. Also please comment if you have a better idea.
    Quack
  7. Like
    Aether got a reaction from SteveT in Adding more filters to results page possible?   
    Hi @SteveT,
    As far as I understand, you want to have second/another search within the primary search. Basically, search again after in the filtered result.
    If that is what you want then I suggest that you follow these process:
     (1) Create a Submission form with Virtual field(s) *for your first search/filter -> check "OnExit" in the advance option and change the parameter name ->  then paste the next URL (the search and report DataPage):

    (2) Create a Search and Report DataPage then in the configuration of search field(s), received the parameter that is being passed.  Then follow the 2 scenarios below:
    Case 1 (Search with a different field):
    If the first search is to filter the initial result then you will do search again with a different field then do this process:


    Case 2 (Search with the same field):
    If you will also search with the same field to get a result then do this process:


    Let me know if you have further questions.
    I hope this helps  
    ~WatashiwaJin~
     
  8. Like
    Aether got a reaction from researched in The week for the month   
    Hi @FinTheHuman - In addition for the earlier response, you can also use this formula to get the week number with the corresponding month via DataPage level:
     
    CASE WHEN (DatePart(day, DateDiff(day, 0, [@field:DATE])/7 * 7)/7 + 1) = 1 THEN 'Week 1 of ' + (DATENAME(month, [@field:DATE])) WHEN (DatePart(day, DateDiff(day, 0, [@field:DATE])/7 * 7)/7 + 1) = 2 THEN 'Week 2 of ' + (DATENAME(month, [@field:DATE])) WHEN (DatePart(day, DateDiff(day, 0, [@field:DATE])/7 * 7)/7 + 1) = 3 THEN 'Week 3 of ' + (DATENAME(month, [@field:DATE])) WHEN (DatePart(day, DateDiff(day, 0, [@field:DATE])/7 * 7)/7 + 1) = 4 THEN 'Week 4 of ' + (DATENAME(month, [@field:DATE])) ELSE 'Week 5 of ' + (DATENAME(month, [@field:DATE])) END ~WatashiwaJin~
  9. Like
    Aether reacted to Nuke354 in Work Around Solution for Printing Reports   
    I suggest using Print.js. With Print.js you can target the specific id of the element that you wanted to print out as a PDF.
    More info on the link here: https://printjs.crabbly.com/
  10. Thanks
    Aether got a reaction from kpcollier in Move Buttons to Side Of Search Box   
    Hi @kpcollier,
    As I said in the earlier response, you just need to adjust the margin of the style for your div. 

    This is the result: 

    Check it out here: https://c1abv183.caspio.com/dp/482760006540f98089034387a563
  11. Like
    Aether got a reaction from kpcollier in Move Buttons to Side Of Search Box   
    Hi @kpcollier,
    You can try to add and customize the button style for you to be able to do that.
    For Example, you can try this similar workflow:
    Add this code in the header of your search form:
    <style> input[type="button"] { background-color: #008CBA; width: 150px; color: white; padding: 5px; text-align: center; text-decoration: none; display: inline-block; font-size: 14px; } #customstyle { position: fixed; padding: 24px 3px; margin: -69px -10px; cursor: pointer; } </style> Then insert an HTML Block in the very bottom of the search form  to add this code:
    <div id="customstyle"> <input type="button" value="Go to Google" onclick="window.location.href='https://google.com/'" /> </br> </br> <input type="button" value="Caspio site" onclick="window.location.href='https://caspio.com/'"/> </br> </br> <input type="button" value="Check YouTube" onclick="window.location.href='https://youtube.com/'"/> <div> Important note:
    - Add the button(s) (HTML Block) in the very last part of the form.
    - Check "Continue next element on the same line" in the advanced option of the field before the HTML Block where the button is located:

    - Make sure that you unchecked the "Enable HTML editor" in the advance option of your Header and HTML Block.

    - This is a custom CSS code and adjustment/configuration might not be compatible in your current search form so you will need to change the (padding and margin) to adjust them.
    You can check the result here:
    https://c1abv183.caspio.com/dp/482760006540f98089034387a563
    I hope this helps
    ~WatashiwaJin~
  12. Like
    Aether got a reaction from kpcollier in Center Pop-up window   
    Hello @FinTheHuman,
    You can try to use this custom code to center your pop-up window:
    <script language="javascript" type="text/javascript"> function OpenPopupCenter(pageURL, title, w, h) { var left = (screen.width - w) + 1350; var top = (screen.height - h) / 10; var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', left=' + left +', top=' + top); } </script> <button onclick="OpenPopupCenter('http://www.google.com', '', 800, 1000);">Go to Google</button> You can change the following data in this line of code:

    You can try this sample URL for testing: https://c1abv183.caspio.com/dp/482760007ae3812e935c495e9514
    I hope this helps  
    ~WatashiwaJin~
  13. Like
    Aether got a reaction from Becca37 in Importing/Exporting spreadsheet with list-DataType   
    Hello @IamGroot,
    Just wanted to inform you, I found a way to export/import a table/database with List-DataType value inside it. 
    1. Change the DataType to "Text(255) field" and Export it.
    2. And in your Excel file, make sure that the value for the List-String field is comma separated like this: (Item1,Item2,Item3,Item4, etc.)
    3. Proceed with the import as usual. After successfully importing your file. Go to your Table and to the Table Design.
    4.  Change the "Text(255) Field" (The one we changed in step 1) back to List-String DataType.
    5. Then it will just return the way it was. If you want to export it (reapeat step(1)).
    I hope this helps  
    ~WatashiwaJin~
  14. Thanks
    Aether got a reaction from SunakoChan in Importing/Exporting spreadsheet with list-DataType   
    Hello @IamGroot,
    Just wanted to inform you, I found a way to export/import a table/database with List-DataType value inside it. 
    1. Change the DataType to "Text(255) field" and Export it.
    2. And in your Excel file, make sure that the value for the List-String field is comma separated like this: (Item1,Item2,Item3,Item4, etc.)
    3. Proceed with the import as usual. After successfully importing your file. Go to your Table and to the Table Design.
    4.  Change the "Text(255) Field" (The one we changed in step 1) back to List-String DataType.
    5. Then it will just return the way it was. If you want to export it (reapeat step(1)).
    I hope this helps  
    ~WatashiwaJin~
  15. Haha
    Aether reacted to Glitch in DATEDIFF: calculate Years, months and days at same time   
    In addition to the last comment,
    Here's another How-To article on how to use the DateDiff function.
    Kindly visit this article.
  16. Like
    Aether reacted to ManokNaPula in Display Birthday Message   
    Just to add to the previous comment, I just noticed this recently,
    When a Field for Birthdate is equal to, say December 2018, and it is now January 2019, using "Datediff(Year,[@field:Birthday],GetUTCDate())" as a formula would give me a "1 year" as result, when in fact it should not. I guess it's because I used "Year" as the DateDiff option.
    What I did was "Datediff(Month,[@field:Birthday],GetUTCDate())/12", it did somehow responds to the age correctly, but when my birth month comes, it adds to my age. I can accept that tho.

    So just in case someone encounter the same problem, I hope this helps!  
  17. Like
    Aether got a reaction from Taneya in Importing/Exporting spreadsheet with list-DataType   
    Hello @IamGroot,
    Just wanted to inform you, I found a way to export/import a table/database with List-DataType value inside it. 
    1. Change the DataType to "Text(255) field" and Export it.
    2. And in your Excel file, make sure that the value for the List-String field is comma separated like this: (Item1,Item2,Item3,Item4, etc.)
    3. Proceed with the import as usual. After successfully importing your file. Go to your Table and to the Table Design.
    4.  Change the "Text(255) Field" (The one we changed in step 1) back to List-String DataType.
    5. Then it will just return the way it was. If you want to export it (reapeat step(1)).
    I hope this helps  
    ~WatashiwaJin~
  18. Thanks
    Aether got a reaction from FinTheHuman in List-Box inside the Collapsible Section   
    Hello @FinTheHuman,
    That is indeed an unusual behavior, well you can try to add this code to the Header: 
    <style> .cbFormSelect { min-width: 400px !important; } </style>  Just to alter the width of your multi select Listbox. And make sure that you unchecked the "enabled HTML Editor" in the advance option of the Header.
    I hope this helps  
    ~WatashiwaJin~
  19. Thanks
    Aether got a reaction from FinTheHuman in Conditional Authentication   
    Hi @JanineB,
    You can create a single Log-In screen for this.
    Alter the code provided in the documentation just add (& "[@authfield:Checkbox]" == "1"). This action is just to identify if the checkbox is checked or not.
    Please note that in checkbox (Yes/check = 1) and (No/uncheck = 0)
    You can refer to this documentation: https://howto.caspio.com/tech-tips-and-articles/common-customizations/create-user-specific-redirect-after-login/
     
    I hope this helps  
  20. Thanks
    Aether reacted to IamGroot in Conditional Styling to hide Submit Button   
    Hi @Scott17,
    You can try and use this code instead:
    Just change the "SubmitButtonId" to the ID of your Submit button.
     
    I hope this helps you  
  21. Sad
    Aether reacted to IamGroot in Importing/Exporting spreadsheet with list-DataType   
    Hello @WatashiwaJin,
    Just wanted to let you know that I also experience that kind of issue before, and when I ask Caspio support they informed me that importing or exporting table(s) with List Data-Type values will not be included because they said that this issue is one of the current Caspio’s limitation.
    Regards,
    IamGroot
  22. Thanks
    Aether reacted to LunaLovegood in Connect to Google Drive   
    Hello @directrix,
     
    I got this same error and contacted their support team. Then advised me that this is a Google issue as they have made changes recently. But if you have an existing task that is connected to Google Drive, it'll work perfectly. Fret not, Caspio DevOps team is now looking for a way to make this work. *winks*
×
×
  • Create New...