Jump to content

DesiLogi

Caspio Guru
  • Content Count

    212
  • Joined

  • Last visited

  • Days Won

    15

DesiLogi last won the day on November 15 2019

DesiLogi had the most liked content!

1 Follower

About DesiLogi

  • Rank
    Advanced Member

Recent Profile Visitors

1,885 profile views
  1. In case anyone needs it, I have the solution, with Caspio's help, for Rounding Up to nearest 15 minute increments and then turning that into a numerical value: Add two (2) virtual fields which will consist of different formulas that will be used in another calculated field. For the first virtual field, the formula below will get the elapsed time of the Start_Time and End_Time: (Datediff(minute,[@field:Start_Time], [@field:End_Time]))/60.00 For the second virtual field, the formula will get only the decimal places excluding the whole number: CAST((Substring('[@cbParamVirtual1]', Charindex('.', '[@cbParamVirtual1]', 0), 3)) as FLOAT) Then in the Qty (number) field (set to Calculated Value) use: (Datediff(minute,[@field:Start_Time], [@field:End_Time]))/60 + CASE WHEN [@cbParamVirtual2] <= 0.25 AND [@cbParamVirtual2] != 0 THEN .25 WHEN [@cbParamVirtual2] > 0.25 AND [@cbParamVirtual2] <= 0.5 THEN .50 WHEN [@cbParamVirtual2] > 0.50 AND [@cbParamVirtual2] <= 0.75 THEN .75WHEN [@cbParamVirtual2] > 0.75 AND [@cbParamVirtual2] <= 1 THEN 1 ELSE 0 END For example, if elapsed time is 36 minutes it will get you 45 minutes and .75 instead of 30 minutes and .5.
  2. Got it figured out- below is the code if anyone needs this solution: var MyPopUp = false; function stopwatch(myURL, title, myWidth, myHeight){ //checks to see if window is open if(MyPopUp && !MyPopUp.closed) { MyPopUp.focus(); //If already Open Set focus } else { var left = (screen.width - myWidth) / 2; var top = (screen.height - myHeight) / 4; MyPopUp = window.open(myURL, title,'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + myWidth + ', height=' + myHeight + ', top=' + top + ', left=' + left);//Open a new PopUp window } }
  3. Hi Andrew, Thanks for the tip but doesn't that mean you'd have to list out all the criteria up to several hundred, in the same formula? Meaning 1-15, 16-30, 31-45, on up to over 1000? I
  4. Hello, I have a button that opens a popup form that has a submission datapage in it. Often the user will minimize the popup because they leave the submission form open for up to a few hours (it's a timer, with a Start and a Finish time- they click 'Start' and don't submit till they later click 'Finish.' The problem is if the popup is already open the button's code reactivates it, and also refreshes the submission datapage, losing the values that were first put in it. I need to adjust the code so that if the user click sthe button again it needs to a) check to see if the popup is already open and, if so, un-minimize it and b) if the popup is not already open, then open it as normal. The is code and the button are below so it's clear how it's set up- it somehow needs to have the If/Else clause fixed. Any help would be really appreciated. <button class="shortbtnicon" type="button" onclick=" stopwatch ('https://example.com/shortcuts/stopwatch', 'MyPopUp', 450, 650);"><span><i class="fa fa-clock-o fa-1x"></i></button> Here's the jquery to create the popup: function stopwatch(myURL, title, myWidth, myHeight) { var left = (screen.width - myWidth) / 2; var top = (screen.height - myHeight) / 4; var myWindow = window.open(myURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + myWidth + ', height=' + myHeight + ', top=' + top + ', left=' + left); } It needs to be something like the below code (but this doesn't work): var popupurl = "https://example.com/shortcuts/stopwatch"; function stopwatch(myURL, title, myWidth, myHeight){ //checks to see if window is open if(popupurl && !popupurl.closed) { popupurl.focus(); //If already Open Set focus } else { function stopwatch(myURL, title, myWidth, myHeight) { var left = (screen.width - myWidth) / 2; var top = (screen.height - myHeight) / 4; var myWindow = window.open(myURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + myWidth + ', height=' + myHeight + ', top=' + top + ', left=' + left); } stopwatch(); } }
  5. Hi NiceDuck, I should have been clearer--the field is a regular number field with a setting of Calculated Value, so it's not technically a calculated field. I have it working as needed now, just need to Round Up as posted earlier in the thread.
  6. Hello, Is there a way to refresh a calculated field when a button is clicked? I have a field set to 'Calculated Field' in a submission form that references a couple other fields that themselves are updated with a button's js function. When you don't manually (type in) update a field then the calculated field won't show any changes. So when my button's function runs and Field1 gets a timestamp, the calculated field that uses Field1 doesn't refresh. It does refresh if I type in the time/date to Field1. I'm need to show the refreshed value in the calculated field before it is submitted. Any help would be appreciated!
  7. Thank you for the help- very much appreciated. Andrew's code worked well and I also put together a shorter version from Meekee's links and a little StackOverflow searching: (Round(((Datediff(minute,[@field:Start_Time],[@field:End_Time])/60.00)*4),0))/4 This will get a 15 minute increment into a number value rounded to .25 (meaning 1-7 minutes = 0, 8-22 minutes=.25, 23-37 minutes= .5, 38-52 minutes= .75, 53-67 minutes=1"). The only issue left is I need to Round Up (so that 1-15 minutes = .25, 16-30 minutes = .5, 31-45 minutes = .75, 46-60 minutes = 1). Right now the rounding will round down if the value is less than half the span. I tried using CEILING instead of ROUND (sql) but the calculated field won't take it. Does anyone know how to modify the above formula but to Round Up?
  8. Hello, I have a number field ('Qty') in a submission form that is for recording the quantity of hours worked. So for example if someone worked 1 hour and 15 minutes the Qty value would be entered as 1.25. A new option I put in the submission form is a Start_Time field and an End_Time field (both Date/Time fields). A button running js puts the current date/time stamp in the Start_Time field and then when the user is done they click a button to put the new current date/time stamp in the End_Time field. The difference between the two are the minutes worked, put in the Qty field via CalculatedField setting: Datediff(minute,[@field:Start_Time],[@field:End_Time])/60.00. This seems to work well so far. What I then need to do is Round Up to the nearest 15 minute value. For example, if the calculation for Start_Time 12/31/2019 11:45 and End_Time 12/31/2019 14:10 returns 2.416666 I need it to round up to 2.5. I've tried various Round() scenarios but can't get it right. Basically, I want the Qty value to always be a version of .25, .5, .75, 1, 1.25, 1.5, 1.75, 2, etc. Does anyone know how to use Round in the calculation above to do that? Many thanks!
  9. Hi Wimtracking2, Glad you got it answered-I was just about to post what might be a solution: This code in the footer will highlight the choices selected in the listbox (my field is called 'AssignedTo'. <script type="text/javascript"> var v_state = "[@field:Assigned_To]" ; var o_state = document.getElementById("EditRecordAssigned_To") ; o_state.multiple = true ; function f_listbox() { if ( v_state.indexOf(",") > 0 ) { for (var i=0 ; i < o_state.options.length; i++ ) { if(o_state[i].value == v_state) { o_state.remove(i); break ; } } var o_st = v_state.split(", ") ; for (var j=0 ; j < o_st.length; j++) { for (var i=0 ; i < o_state.options.length; i++ ) { if(o_st[j]== o_state.options[i].value){ o_state.options[i].selected = true ; break ; } } } } } //window.onload = f_listbox ; document.addEventListener('DataPageReady', f_listbox()); </script>
  10. Thanks Andrew- I ended up created a middle-ware to send images to AWS S3 and their link back to a text field in Caspio. It'd have been great if this were a standard CB feature but at least it's doable as custom.
  11. When I do an Inspect on the page it looks like cbOuterAjaxCtnr is where some of the whitespace comes from. When I manually type in a background color (in inspector) it does change the background. However, in the Style Sources if I put the below code it doesn't work and I can't find anything for cbOuterAjaxContainer. This is what I thought it would need: .cbOuterAjaxCtnr { background-color: #daded1 !important; } EDIT: Ah, I figured it out if anyone else needs to do the same thing: The background setting needs to not be in a Caspio datapage or Style but in the host web page's css. I guess the datapage uses whatever background css the host page uses for the headers and outer containers.
  12. Hi KpCollier, Thanks for digging in on this. I did as you suggested and it did work- except in the strip where the Search box would be located if it's checked 'show above results.' This is some sort of header but I cannot figure out what Caspio calls it. I tried doing an 'inspect' but wasn't able to find the right block in the Style Source to match it. Here's a screenshot of what I mean: the white space isn't affected by the body setting.
  13. Hi KpCollier, Thanks for the tip but I need to put this in the Stylesheet (in Styles)- I have over 500 datapages and they to be updated simultaneously via the Stylesheet. Is there some way to do that there? It seems like there must be.
  14. Hi, I'm trying to change the background color of the wider datapage via Styles, meaning the white space that is 'around' the data table and also the Search and Details forms when they're opened. I've been looking in the Source of Styles in various places but can't figure out what the overall datapage background is called so I can change the color. If anyone can point this out that'd be very helpful!
  15. ah, now I see you can't close a window with js unless it's been opened with js. Thanks for the link Kristina!
×
×
  • Create New...