Jump to content

Mathilda

Caspio Rockstar
  • Content Count

    464
  • Joined

  • Last visited

  • Days Won

    49

Posts posted by Mathilda

  1. On 4/24/2017 at 0:57 PM, roattw said:

    Have some script I want to test in an HTML element - trying to get just a TIME OF DAT picker.  But all the code I have found exceeds the 10,000 character limit in Caspio.  Workaround - reference external file/js?

    Yes, you may reference external js file. If you're looking for a way of getting time from the system parameter - you may use this parameter:  [@cbTimestamp@] 

    Also there is a solution how to get user's  date and time.

    Hope that helps

  2. On 4/27/2017 at 7:07 AM, bbeshlian said:

    Hello,

    Which would be the best DataPage to use for the following? I'd like to have a DataPage that has some prepopulated fields then the remainder of the fields blank which allows the user to complete them. The populated fields contain employee/co-worker information and the blank text fields are where the data can be input for either a peer or self evaluation. I built a Details Report which I tied to a view that pulls all the necessary fields for the evaluation. Currently it grabs every record completed or not. What I need is the DataPage to open up and display the basic employee/co-worker info and blank fields all the time. So what would be the best DataPage to display this with and how do I open it in an "Add" mode?

    Thanks,

    Bill

    Hi Bill,

    I assume that you need a datapage to edit existing records. In case you want allow user edit his profile, you may use an update form.

    If you need to allow user editing more than 1 record, you may use details datapage or results page. 

    As far as I understand, you'd like to allow editing a record only if data in one or more fields is missing. You may use predefined criteria with comparison type"Is not blank" for those fields. This way you will be able to filter records where fields are not blank.

    Hope that helps

  3. 4 hours ago, AFFDEV said:

    Good Day Everyone,

     

    I am trying to timestamp a field if a checkbox is ticked. I am using the following code.

     

    <SCRIPT>

    function Updatetocasd()
    {
    if (document.getElementById("EditRecordccasd").checked==true)
    {
    document.getElementById("EditRecordtocasd").value="[@cbTimestamp*]";
    }


     document.getElementById("caspioform").onsubmit = Updatetocasd;
    </SCRIPT>

     

    But it is not doing anything. Please help

    I see that one closing curly bracket } is missing. Try adding closing curly bracket before this line:

    document.getElementById("caspioform").onsubmit = Updatetocasd;

     

  4. On 4/21/2017 at 6:40 PM, deblock1376 said:

    For anyone who has time, I'd love feedback on this search form on state spending: 

    https://www.clickondetroit.com/news/state-spending-database

    This is the first time I've deployed a search form with the results. It seems to work. Any feedback? Ways to make it better?

    I see that header and submit button are in blue color and results page is green, I think it doesn't look solid, however it's up to you. 

    Also I would recommend adding date range, so your customers will be able to get data for a certain period, not for one date only.

    You can do that using criteria for the date field. The comparison type for the first criteria will be grater than or equal, so the second one - less than or equal. Don't forget to pass criteria parameters from the search datapage to predefined criteria on report.

    Hope that helps :)

  5. On 4/22/2017 at 9:55 PM, roattw said:

    I have a table field AGE set as an integer.  I need the form to disallow alpha characters in that field when exiting that field.  Cant get it to work.  I still have submissions allowing "approx. 50" and I need to limit them to discrete numbers only.

    I added this script in footer, which helps, but its only on submit.  Isnt the fact that the field type is INTEGER mean it wont accept letters by default?

     

    Can I use HTML5 to make it easy?

    <input type="number" name="quantity" min="1" max="5">

    It seems that you posted your question twice. I replied here

  6. On 4/22/2017 at 9:53 PM, roattw said:

    I have a table field AGE set as an integer.  I need the form to disallow alpha characters in that field when exiting that field.  Cant get ti to work.  I still have submissions allowing "approx. 50" and I need to limit them to discrete numbers only.

    I added this script in footer, which helps, but its only on submit.  Isnt the fact that the field type is INTEGER mean it wont accept letters by default?

    <script>function isNumberKey(evt){ var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57)) return false; return true;}document.getElementById('@field:Age').onkeypress =isNumberKey;</script>

    You need to use this script in the html block. Add html block, place it below all the fields, hit Source tab and insert your script. Also I would recommend using complete syntax InsertRecordAge instead of '@field:Age'.

    Integer datatype doesn't allow entering characters only on the table level in datasheet view.

    Hope that helps.

  7. 11 hours ago, rocketlaunchapps said:

    Hello,

    I would like to create a DATA PAGE that only gives access to SALES MANAGERS to then view a list of customers created by 1) himself and 2) by users within his team.  I do not want SALES MANAGER "A" to be able to see SALES MANAGER "B" listings.  There will be a team of 5 people assigned to Manager "A" and a team of 10 people assigned to MANAGER "B".  

    1. If MANAGER "A" logs in, I want him to see his customers as well as ALL of his teams customers. 

    2. If a user logs in, then I want him to see only his customers (nobody else from the team)

    Is this possible with RLS?  How do I accomplish this?

    Hi,

    Yes, it's possible, however you would need to create two separate datapages one for managers and another for team members.

    I suppose that you store team member ID (user ID) and team label (team A or team B )for each team member in the table which stores information about the user.  Also I suppose that you stamp team member ID for each customer to identify who is assigned to the customer.

     Since those tables are related, I would recommend joining two tables in a view, use that view as a data source for report. For manager you need to set RLS settings to compare team label in the authentication datasource to the team label in the datasource view, so manager will see all the records, related only to his team. For team member you need to compare team member ID in the data source to team member ID in authentication, this way each team member will see only records, assigned to him.

    Hope that helps. 

  8. 7 hours ago, jblythe8121 said:

    In addition to the standard 'first name' and 'last name' fields on my submission form, I have also included a 'nickname' option.  Currently on my results form I have a configured field set up with this formula:  [@field:First_Name] + SPACE(1) + CHAR(34) + [@field:Nickname] + CHAR(34) + SPACE(1) + [@field:Last_Name] and it works brilliantly when there is a nickname.  However, if there isn't then I get a weird result that looks something like this:  Jane "" Doe

    Long question short, how do i get the quotation marks to only show up when there is something actually in the nickname field (checking the box 'hide if blank' doesn't work, I still get the weird quotations side by side between the first and last name.  

    I'm open to suggestions.  Thanks in advance for your help. - Juliette

    Hi Juliette,

    As far as I understand you use calculated field. You may use CASE statement and check if the nickname has value. 

    CASE 
    
    WHEN Len([@field:Nickname])>1 
    Then '[@field:First_Name]' + SPACE(1) + CHAR(34) + '[@field:Nickname]' + CHAR(34) + SPACE(1) + '[@field:Last_Name]'
    
    ELSE '[@field:First_Name]' + SPACE(1) +  '[@field:Last_Name]'
    
    END

     

  9. On 4/19/2017 at 1:39 PM, Clint said:

    I have a working conditional statement using SQL. However, the output (following the "then" statement outputs plain text.

    Does anyone know how to force it to be formatted as a clickable link?

    Here's the full statement: 

    
    CASE
    
    WHEN [@field:connect_PIF_ER_eval_complete]='' then '<a href="participant_evaluation.html?ER_ID=[@field:ER_Events_1_ER_ID]&Ev_Type=[@field:ER_Events_1_Event_Type]">Evaluation</a>'
    
    ELSE 'Evaluation Completed'
    
    END

    I'm sure it's obvious, I'm just not sure what needs to surround the href tag. 

    Thanks!

    You can't use html tags in calculated fields.  You need to use Java Script. As far as I understand, you need to show link only if the field is blank.

    I would recommend using the following script in html block

    <script>
    if ('[@field:connect_PIF_ER_eval_complete]'.length<1) {
    document.write('<a href="participant_evaluation.html?ER_ID=[@field:ER_Events_1_ER_ID]&Ev_Type=[@field:ER_Events_1_Event_Type]">Evaluation</a>');
    }
    else {
    document.write('Evaluation Completed');
    }
    
    </script>


     

  10. Hi, you may use the following script in the footer of the datapage:

    <SCRIPT LANGUAGE="JavaScript">
     
    function calculate()
    
    {
    var check = document.getElementById("InsertRecordField_name").value;
    
    if(check =="Approved"){
    
    var v_increment = parseFloat(document.getElementsByName("cbParamVirtual1")[0].value);
    
    
       document.getElementById("InsertRecordField2").value = v_increment+1;
     }
    }
    
     document.getElementById("caspioform").onsubmit=calculate;
    
    </SCRIPT>

    You need to use a virtual field to sort values in descending order and get the last submitted value, then increment value and write in a field

  11. 19 hours ago, zock1 said:

    ok, a bit more information is needed.

    There is a submission datapage (dpA) that inserts and maintains records from a table. I need also that a record is added into another table every time a new record is added on dpA. So this other datapage (dpB) receives values from parameters from dpA, inserts the record and returns control to dpA. I wanted to "hide" dpB, the user does not need to see it, and even more important, does not have to press "submit" again (already done at dpA). That's why I explored the autosubmit. So all works well this way.

    The added functionality I wanted was to not add the related record in dpB when one of the passed parameter is empty. With the changes suggested, when the parameter is empty (else in check.length > 0), dpB becomes visible and I have to press the submit to return to dpA. which is not the behaviour I want. So I was expecting to have to add some code in the else part to cancel that form and return back to dpA:

    while dpB hidden,

    if parameter is empty then submit, else cancel,

    return to DPA

    Another option would be to trap the empty parameter in dpA before passing control to dpB, but I use the destination on the last part of the wizard and not sure how to put a condition there.

    Hope that's a bit more clearer ...

    Thanks in advance

     

    Yes, your workflow is more clear now. I updated script with additional condition:

    <script type="text/javascript">
    window.onload=function myfunc(){
    var check=document.getElementById("InsertRecordYour_field").value;
    
    if (check.length>0){
      document.getElementById("caspioform").style.display = 'none';
      setTimeout('document.forms["caspioform"].submit()',1000); 
    }
    else {
    
    window.location.href = "specify_your_url";
    }
    }
    </script>

     

  12. On 4/10/2017 at 6:33 AM, Clint said:

    Thanks Mathilda - I completely get the query string method. However, we have about 100 parameters that would need to be passed. (out of my control unfortunately).

    I can't seem to get the auto submit method to work, but I'll keep playing with that to make it work. (I think the problem is that my details html page, where I want to place the button, has multiple datapages deployed.)

    Are there any other solutions that you're aware of?

    Yes, one more option is available. You may create a separate details datapage, make all fields to pass parameters and add an autosubmit script. Also create a submission form, add auto submit script and receive parameters in all the fields. In the destination after record update (in detail datapage) redirect to the submission form. Deploy the details datapage in html block on results page, you may find the similar solution here.

    So the workflow will be like this: You hit the link, the details datpages opens, autosubmits itself, passes parameters and redirects to the submission form. The submission form receives parameters, autosubmits itself and inserts a new record to your table.

    Hope that helps.

  13. On 1/29/2016 at 11:28 AM, Master said:

    How can I disable delete pop up confirmation page? I do not want this pop up in my details page.

    I see that this post is old, however if someone else wants to do the same, you may use the script below:

    <script type="text/javascript">
    
    function to_confirm()
    {
    var alertWindow = document.getElementsByClassName("Alert")[0];
    alertWindow.getElementsByTagName("input")[2].click();
    }
    
    document.getElementById("Mod0DeleteRecord").onclick=function to_delete()
    {
    
    setTimeout(to_confirm,1000);
    }
     
    </script>

     

  14. On 4/9/2017 at 10:05 PM, zock1 said:

    Thanks Mathilda

    I do receive the parameters in fields. I had to change the element from display only to text field. It does work when there is data coming from the parameter (check.length>0 is true), but if it's empty the datapage shows and sits there until I submit. Why is not cancelling?

    If the value is blank, the form will not be submitted. According to your first description it was the expected behavior :)

    What do you mean "not cancelling"? Redirect to another webpage?

  15. 3 hours ago, zzounds said:

    Hi Guys my parameters seem to be stuck, even using reset doesn't seem to work, these are all in the preview mode, it used to work great. Now it's like it only remembers the last result, YES I did the reset thing, but nothing worked. Once I click once on the link, the one I click on those results keep showing up doesn't matter if I click afterwards on another link it will show me the results of the first time I clicked. Please help!

    It seems that your parameters were cached. I would recommend clearing cache and cookies in your browser.

    How do you pass parameters? Do you see the same issue on deployed datapage?

     

  16. On 4/9/2017 at 5:30 AM, zzounds said:

    Hi guys, Please have a look at the picture it makes it more clear.

     

    hopefully someone can help with this simple question. So we have a "Customer" making an "order" this "order" has different "products". So 3 tables. When I connect Customer table to order table, no problem, one customer can have multiple order, when I connect orders to products, I want to be able to chose a customer and only see his orders in the products table. At the moment I can select the customer but I get to see all orders, I want to only see his orders. All this in the table.

    At the moment it seems that I can just add a product to a customer but the order is not connect to the customer, so when I choose the customers name from my tables drop-down I can still select all the orders, but this is not correct because this customer did NOT make all the orders. This is essentially what I want to do connect products to customers, and customers are connected to orders. That is basically it hopefully I explained myself. well.

    I included a picture is you look the customer "Tim Sanders" can choose all the orders, but he has NO order so I don't  want him to be able to choose an order. Maybe there is a better and easier way to do this please let me know. All suggestions are really welcome.

     

    Kind regards,

     

    Anthony

    Customer order number.JPG

    Hi Anthony,

    I think that cascading fields should help in this case. You may add records using submission form and filter orders based on user ID

  17. On 4/6/2017 at 9:48 PM, roattw said:

    Have a table of data.  Need a report or view showing IF field 1 = X, AND field 2 = A or B or C show those entries.

    So below, if the field Evals = YES AND field Hospital = A, B, C, D, E, E or F - show them to me.  But cant get it to show data:

    Tried it multiple ways, nothing. ;^)

     

     

     

     

     

    logic2.png

    Hi,

    I use the similar logic in my view, view returns needed records. Perhaps there are no fields which match criteria. 

    I usually filter table in the datasheet to verify that criteria works as expected. Also I see that in description you wrote that you filter records where Eval field=YES, however, according to the screenshot Eval field contains "Telemedicine". I don't know if that is the case, perhaps you just put wrong description.

    Hope that helps.

  18. On 4/7/2017 at 9:52 AM, Clint said:

    I'm creating an event management system and I need to be able to have our administrators make copies of events (not recurring, just duplicate the record in the events table - with a new unique ID of course).

    Does anyone know of a way I can insert a copy button as a link in a Tabular datapage or a Single Record Update datapage?

    Thanks so much!

    Clint

    Hi Clint, 

    Yes, it's possible. You need to create a submission form, deploy this form in an html block in your report and pass parameters to that form in query string. This way you may create a link or a button which will call a submission form. If you don't want to change data before submission, you may also add an auto submit script to submit datapage automatically.  

  19. 13 hours ago, zock1 said:

    Hi all

    I have a simple datapage that submits a record to a table. values come from external parameters and it auto submits. This is the code I have at the HTML block:

    <script type="text/javascript">

      if(document.getElementById("caspioform"))
     {
       document.getElementById("caspioform").style.display = 'none';
       setTimeout('document.forms["caspioform"].submit()',1000);
     } 
    </script>

    That works fine.

    What I want to do, if possible, is to add a a clause, if one of the receiving parameters is null, then do not submit the form (or cancel?).

    Any ideas?

    Thanks

    Hi,

    Do you receive parameters in fields? You may check field length and execute auto submission only when lengths is >0. You may also add more conditions and check more than 1 field.

    <script type="text/javascript">
    
    var check=document.getElementById("InsertRecordField_name").value;
    if (check.length>0){
      document.getElementById("caspioform").style.display = 'none';
      setTimeout('document.forms["caspioform"].submit()',1000); 
    }
    
    </script>

    You need you use InsertRecordField_name if you use submission form. In case of using update or details datapage the syntax will be EditRecordField_name

    Hope that helps

  20. 13 hours ago, Esraaa said:

    Hello,

    I am trying to do a function to remove and replace some special characters from a text field using formula DataType, However, how can I remove the apostrophes (') 

     

    Here is the formula (Last one with apostrophe)

    CASE
    WHEN Charindex('!',[@field:TITLE],0) <> 0 THEN Replace([@field:TITLE], '!', '')
    WHEN Charindex('#',[@field:TITLE],0) <> 0 THEN Replace([@field:TITLE], '#', '')
    WHEN Charindex(':',[@field:TITLE],0) <> 0 THEN Replace([@field:TITLE], ':', '')

    WHEN Charindex(''',[@field:TITLE],0) <> 0 THEN Replace([@field:TITLE], ''', '')
    END 

    Hi Esraa,

    Try using the following syntax:

    WHEN Charindex('''',[@field:TITLE], 0) <> 0 THEN Replace([@field:TITLE], '''',' ') 

    Hope that helps

  21. 15 hours ago, ray985 said:

    I have a report that has a calculated field in it that is based on a conditional statement. For one of the options, I would like it to multiply a field by the value of an input box. I can't figure out how to do it though. I've tried passing the value as an external parameter in the URL but I can't figure out how to reference that in the calculated field formula. Right now the input field is on the web page that the Caspio iframe is embedded on, but I can also move the input to the header of the form if that would help.  

    Is there a way to do this? I'm using the code below...

    
    CASE
    
    WHEN [@field:Per]='lamp' THEN [@field:Per] * 2
    WHEN [@field:Per]='fixture' THEN [@field:Cost] * EXTERNALPARAMETER
    ELSE 0
    
    END

     

    I would recommend wrapping parameter name in single quotes, e.g.: '[@param_name]'

    This way you will be able to use parameter in sql query. In case of passing parameters to iframe,  you need to use special syntax, try using this solution

    Hope that helps

  22. 17 hours ago, TP007 said:

    Hi There, 

    I'm just wondering if you can help. I want to create a form that allows user to enter username and password. If it matched the username and password in a table, then return an automatic email with attachments otherwise prompt up a message to say incorrect username and password, please contact.... 

    https://c1eib201.caspio.com/ui/apps/Auto Email/tables

    I have already created a table, but could not work out how. 

    Thanks in advance. 

    Cheers Troy

    Hi Troy,

    welcome to forum :) You may use authentication to check is a user is in your table. If yes, user will get access to the datapage, if no he will get an error message. You may also edit error message in localization and create your custom message.

    Will that attachment always be the same for all the users? If yes you may use submission form with autosubmit script. If you need to take data from the table, you may use details page with autosubmit script.

    Hope that helps :)

  23. 21 hours ago, cigarprofiler said:

    Hi all,

    My project is a database of cigars. The cigar name consists of three parts: brand name, line name and model name. Most info is pertinent to the model and stored in that table. It is linked to the line table with lineid as foreign key. In turn, the line table is linked to the brand table with brandid as foreign key.

    To add a cigar, a user would typically start with selecting a brand , then a line (if applicable, can be blank), then add the model and input the data. But from a db perspective, I have to start with the model table, which contains no reference to a brandid (which is stored in the line table only).

    How can I resolve that?

    From your description it seems that you need to use many-to-many relationship and store brand name as well. I described how to build a many-to-many relationship here

×
×
  • Create New...