Jump to content

nightowl

Caspio Ninja
  • Content Count

    55
  • Joined

  • Last visited

  • Days Won

    5

Reputation Activity

  1. Like
    nightowl got a reaction from William in Calculate Week Number in Formula Field   
    Hi NeoInJS,   Please try using this formula: FLOOR(     (         DATEDIFF(day, CONVERT(datetime, CAST(DATEPART(year, [@field:Start_Time]) AS CHAR(4)) + '-01-01', 101), [@field:Start_Time]) +          (             7 -              (                 (                     (                         (                         DATEPART(day, [@field:Start_Time]) +                          FLOOR(13 * ((CASE WHEN DATEPART(month, [@field:Start_Time]) < 3 THEN DATEPART(month, [@field:Start_Time]) + 12 ELSE DATEPART(month, [@field:Start_Time]) END) + 1) / 5) +                                     ((CASE WHEN DATEPART(month, [@field:Start_Time]) < 3 THEN DATEPART(year,  [@field:Start_Time]) - 1  ELSE DATEPART(year,  [@field:Start_Time]) END) % 100) +                               FLOOR(((CASE WHEN DATEPART(month, [@field:Start_Time]) < 3 THEN DATEPART(year,  [@field:Start_Time]) - 1  ELSE DATEPART(year,  [@field:Start_Time]) END) % 100) / 4) +                                FLOOR((CASE WHEN DATEPART(month, [@field:Start_Time]) < 3 THEN DATEPART(year,  [@field:Start_Time]) - 1  ELSE DATEPART(year,  [@field:Start_Time]) END) / 400) +                                 5 * ((CASE WHEN DATEPART(month, [@field:Start_Time]) < 3 THEN DATEPART(year,  [@field:Start_Time]) - 1  ELSE DATEPART(year,  [@field:Start_Time]) END) / 100)                         ) % 7                     ) + 6                 ) % 7 + 1             )         )     ) / 7 ) + 1   NOTES: You must replace all instances of [@field:Start_Time] with your actual field. You can test for correctness by adding a calculated field that uses DATEPART(week, [@field:Start_Time]).
  2. Like
    nightowl got a reaction from vikovs in Calculate Week Number in Formula Field   
    Hi NeoInJS,   Please try using this formula: FLOOR(     (         DATEDIFF(day, CONVERT(datetime, CAST(DATEPART(year, [@field:Start_Time]) AS CHAR(4)) + '-01-01', 101), [@field:Start_Time]) +          (             7 -              (                 (                     (                         (                         DATEPART(day, [@field:Start_Time]) +                          FLOOR(13 * ((CASE WHEN DATEPART(month, [@field:Start_Time]) < 3 THEN DATEPART(month, [@field:Start_Time]) + 12 ELSE DATEPART(month, [@field:Start_Time]) END) + 1) / 5) +                                     ((CASE WHEN DATEPART(month, [@field:Start_Time]) < 3 THEN DATEPART(year,  [@field:Start_Time]) - 1  ELSE DATEPART(year,  [@field:Start_Time]) END) % 100) +                               FLOOR(((CASE WHEN DATEPART(month, [@field:Start_Time]) < 3 THEN DATEPART(year,  [@field:Start_Time]) - 1  ELSE DATEPART(year,  [@field:Start_Time]) END) % 100) / 4) +                                FLOOR((CASE WHEN DATEPART(month, [@field:Start_Time]) < 3 THEN DATEPART(year,  [@field:Start_Time]) - 1  ELSE DATEPART(year,  [@field:Start_Time]) END) / 400) +                                 5 * ((CASE WHEN DATEPART(month, [@field:Start_Time]) < 3 THEN DATEPART(year,  [@field:Start_Time]) - 1  ELSE DATEPART(year,  [@field:Start_Time]) END) / 100)                         ) % 7                     ) + 6                 ) % 7 + 1             )         )     ) / 7 ) + 1   NOTES: You must replace all instances of [@field:Start_Time] with your actual field. You can test for correctness by adding a calculated field that uses DATEPART(week, [@field:Start_Time]).
  3. Like
    nightowl got a reaction from Sindhuja in Multiple Submissions Of Form In One Page   
    Hi Kirkman,
    You can try this template code inside an HTML file or HTML DataPage:
    <div class="forms-container" class="container-fluid"> <div class="row datapage-row"> <div class="col-md-12 col-sm-12 col-xs-12"> <!-- TODO: Put your DataPage [iframe] embed code here --> <script type="text/javascript" src="https://c2eru839.caspio.com/scripts/embed.js"></script> <!--<script type="text/javascript">try{f_cbload(true, "c2eru839.caspio.com", "148b400049998e67f1434f05bf7f");}catch(v_e){;}</script>--> <iframe name="ACBL New Profile" title="ACBL New Profile" src="https://c2eru839.caspio.com/dp.asp?AppKey=148b400049998e67f1434f05bf7f" width="100%" height="200px" style="border-style: none">Sorry, but your browser does not support frames.</iframe> </div> </div> <div class="row spacer">&nbsp;</div> <button id="add-department" style="display: inline-block !important; float: right;">Add Department</button> </div> <!-- Latest jQuery + jQuery Migrate --> <script src="https://code.jquery.com/jquery-3.2.1.js"></script> <script src="https://code.jquery.com/jquery-migrate-3.0.0.js"></script> <!-- Custom scripts --> <script> $(document).ready( function (event) { var formsContainer = $('.forms-container').last(); var addDepartmentButton = $('#add-department'); addDepartmentButton.click( function (event) { var dpClone = $('.datapage-row').last().clone(); var spacer = $('.spacer').last(); var spacerClone = spacer.clone(); spacer.after(dpClone); dpClone.after(spacerClone); } ); } ) </script> Hope this helps.
  4. Thanks
    nightowl got a reaction from TaylorAccess in Calculate Week Number in Formula Field   
    Hi NeoInJS,   Please try using this formula: FLOOR(     (         DATEDIFF(day, CONVERT(datetime, CAST(DATEPART(year, [@field:Start_Time]) AS CHAR(4)) + '-01-01', 101), [@field:Start_Time]) +          (             7 -              (                 (                     (                         (                         DATEPART(day, [@field:Start_Time]) +                          FLOOR(13 * ((CASE WHEN DATEPART(month, [@field:Start_Time]) < 3 THEN DATEPART(month, [@field:Start_Time]) + 12 ELSE DATEPART(month, [@field:Start_Time]) END) + 1) / 5) +                                     ((CASE WHEN DATEPART(month, [@field:Start_Time]) < 3 THEN DATEPART(year,  [@field:Start_Time]) - 1  ELSE DATEPART(year,  [@field:Start_Time]) END) % 100) +                               FLOOR(((CASE WHEN DATEPART(month, [@field:Start_Time]) < 3 THEN DATEPART(year,  [@field:Start_Time]) - 1  ELSE DATEPART(year,  [@field:Start_Time]) END) % 100) / 4) +                                FLOOR((CASE WHEN DATEPART(month, [@field:Start_Time]) < 3 THEN DATEPART(year,  [@field:Start_Time]) - 1  ELSE DATEPART(year,  [@field:Start_Time]) END) / 400) +                                 5 * ((CASE WHEN DATEPART(month, [@field:Start_Time]) < 3 THEN DATEPART(year,  [@field:Start_Time]) - 1  ELSE DATEPART(year,  [@field:Start_Time]) END) / 100)                         ) % 7                     ) + 6                 ) % 7 + 1             )         )     ) / 7 ) + 1   NOTES: You must replace all instances of [@field:Start_Time] with your actual field. You can test for correctness by adding a calculated field that uses DATEPART(week, [@field:Start_Time]).
  5. Thanks
    nightowl got a reaction from danielg05 in Multiple values separated by commas input   
    Hi NeoInJS,
    If you're trying to achieve something like this:
    var fields = [tag1 tag2 tag3 tag4 tag5]
    tag1 will be saved as field #1 tag2 will be saved as field #2 tag3 will be saved as field #3 tag4 will be saved as field #4 tag5 will be saved as field #5 Then, you can use the jQuery Tag-it! library to achieve this.
    You can then use the following script in the footer of your submission page:
    <!-- Latest jQuery + jQuery Migrate --> <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> <script src="https://code.jquery.com/jquery-migrate-3.0.0.js"></script> <!-- jQuery UI: Required by Tag-It! --> <script src="//code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script> <!-- jQuery Tag-It! --> <script src="//aehlke.github.io/tag-it/js/tag-it.js" type="text/javascript" charset="utf-8"></script> <!-- Required jQuery UI Theme + Tag-It! theme --> <link href="//code.jquery.com/ui/1.12.1/themes/hot-sneaks/jquery-ui.css" rel="stylesheet" type="text/css"> <link href="//aehlke.github.io/tag-it/css/jquery.tagit.css" rel="stylesheet" type="text/css"> <script language="JavaScript"> document.getElementById('caspioform').onsubmit = function () { // TODO: Add your field names here var fields = ['Tag_1', 'Tag_2', 'Tag_3', 'Tag_4', 'Tag_5']; var input = document.getElementById('cbParamVirtual1').value; var values = input.split(','); values.forEach( function (value, index) { // Map each CSV segment to each field in the 'fields' list above document.getElementById('InsertRecord' + fields[index]).value = value.trim(); } ); } </script> <script language="JavaScript"> function alphanumeric(v_plate) { if (!(v_plate.value.match(/[^a-zA-Z0-9,\-]|(,,)|(,,,)|(,,,,)|(,,,,,)| \s | # | @ | ! | ? | $ | % | ^ | & | * | ( | ) | ~ | ` | _ | + | = | ; | . | > | < | : | " | ' | 1{2,} /))) { return true; } else { alert("Only letters or numbers are allowed in this field"); return false; } } </script> <script language="JavaScript"> $(document).ready( function () { var v_b = document.getElementById('Submit'); v_b.onclick = function () { if (alphanumeric(document.getElementById('cbParamVirtual1'))) { document.getElementById('caspioform').submit(); } else { return false; } } $('#cbParamVirtual1').tagit( { // The hypothetical 'cbParamVirtual1' above is what I am trying to point to the Virtual1 text area in the DataPage. // This will make JQuery Tag-it feature submit an array of values as shown in the script above, as comma-delimited. // The hope is that the rules remain consistent through all through scripts. All I am trying to do is change the display // effect on the front end. No changes are required to the back end. singleField: true, singleFieldDelimiter: ',' } ); } ); </script> To change the jQuery UI theme used by the script above:
    Please go to https://code.jquery.com/ui/. Choose your theme from the jQuery UI 1.12 > Themes section and copy the link address. Replace the href attribute in the following line with the link you've got from STEP #2: <link href="//code.jquery.com/ui/1.12.1/themes/hot-sneaks/jquery-ui.css" rel="stylesheet" type="text/css"> Hope this helps.
×
×
  • Create New...