Is there a way to create a customized validator to validate the data that is imported from csv file in REDCap?
I'm not entirely sure what you mean but I will try to answer your question as best as possible.
To begin with, you can customize what validation is used on a per-field level in REDCap, by simply editing a field and selecting a field type. E. g. if it's a 'text' field with the 'integer' constraint activated, data for that field in uploaded .csv files will be checked to ensure that only integer values are imported. You can add some extra constraints as well, using e. g. min/max values or action tags (link to PDF document about action tags). Note that if you use 'multiple choice'/'checkboxes' type fields, where you manually specify a limited number of possible field choices, uploaded data will be checked to make sure that all values for the field are in the list of allowed field choices.
If you mean that you want to bypass REDCap's validation process so that it allows some normally invalid values to be uploaded (say a value of 2.5 for a 'text' field with the 'integer' constraint), I don't think that's possible, and I don't think there's any good reason for wanting to do that. If you want a field to be less 'lax' about validation, then you can change its type to a more general one. So if you have a 'text' field with the 'integer' constraint, you can simply remove the 'integer' constraint and have it be a plain 'text' field. But be careful if you do this. Think about whether you are removing constraints because actually valid data aren't allowed to be uploaded, or if you are trying to upload invalid data that ought to be removed or fixed. If it's the latter you should definitely leave the validation as it is, because then it's doing its job and letting you know what needs to be corrected.
If you want to add additional validation, making it stricter than what REDCap does at the moment, then you can of course change the field types to be more narrow, e. g. adding an 'integer' constraint to a 'text' field, or changing a 'text' field to be a 'multiple choice' field. That's the solution in REDCap. If you want to add additional constraints/validation, that REDCap doesn't support, I think you'll have to pre-process the data before upload. If you want to automate the validation process then you could write a script in R or Python that:
Imports the .csv data (e. g. with read.csv/read_csv)
Filters the data the way you want (e.g. if you want to exclude certain strings that have a pattern to them, you could use R's 'stringr' package or Python's 're' package)
Uploads the data to REDCap using the REDCap API (for R there's the 'redcapAPI' package, and for Python there's the 'PyCap' package)
Note that you would need an API key, which you can ask your institution's REDCap administrators for, if you'd want your script to upload the data directly. You can of course also create a script that, instead of uploading the data directly, produces .csv files for upload.
If you're not very familiar with R, Python or other programming languages/tools that enable you to craft validation scripts it's probably best to work with what REDCap itself offers you.
Related
For my current project, I'm making a sheet that lets me keep track of my D&D characters. I use data validation to remind me what all the options are for various stats, with the information being kept in a separate "RefTables" sheet. Creating a data validation for selecting a character class is very easy, since there are only 14 classes total. What I'm having trouble with is the 'subclass' column. After you choose the character class, you get to choose your specialization, or 'subclass'. This differs depending on the character class you chose.
Right now I can do the proper data validation for each cell individually. In my ref tables sheet, I have a section where it will grab the character class value and put all the 'subclass' options into a row. I can then use data validation in that specific cell to grab the subclass row. This works, but is tedious to do for every single cell.
The formula I would love to put in the range section is
=INDIRECT(CONCATENATE("RefTables!Q",ROW(),":AJ",ROW()))
which appends the row number with the appropriate columns so each row automatically gets its own subclass row (EX: RefTables!Q3:AJ3, RefTables!Q21:AJ21, etc.). I've seen solutions for Excel, but I'm using Google Sheets so I can share this document more easily with friends.
tldr; How to use data validation in Google Sheets that is slightly different for each row
unfortunately, this is possible to achieve only the manual way setting it up for every single cell/row. Google Sheets' Data validation does not support injecting CSVs via formula.
I want a column in my spreadsheet to only have dates in the yyyy-mm-dd format. The format can be set using the Format option but the problem appears when I start using data validation. Now, if I use the standard data validation of "is Date" and do a "Reject Input" in case of any other type of entry, it works perfectly ... until someone copy pastes data in this column - and as soon as that happens, data validation goes away (which is understandable since there's been a paste job done). How can I prevent this problem?
I want the sheet to reject any input or copy paste of data that's not in the yyyy-mm-dd format
Already tried data validation plus formatting
Note: multiple people with varying degrees of tech proficiency will be using this sheet and hence date validation is important
If you are allowing users to write directly into Google Sheets cells, there isn't a way to prevent that they change the date formatting.
The alternatives are to reapply the desired format, either manually or automatically, or to use another method to get user input, like a Google Apps Script prompt or custom dialog.
I'm running some JMeter tests for editing a field. If I use the JMeter HTTP(S) Test Script Recorder, I can get an accurate representation of the page and edits I made.
It creates a HTTP POST request with a parameter for every field, checkbox and dropdown on the page. I only really care about modifying ONE of them.
My problem is I can't just remove all the other parameters from the POST data because the page interprets this as if I removed all of them from the page (and then complains that there's missing data). So I'm left with trying to obtain the current values for the remaining editable fields and checkboxes so that I can re-submit them when I only want to modify a single field.
For an example, imagine I'm submitting some user data with fields for Name, Email and Address. I want to change the name by adding a 1 to the end of it and leave the other two fields as they are.
My thoughts for accomplishing this:
1) Use XPath to try to get the values shown on the page, store them all in variables and re-submit them in the post request. This is messy and also very difficult as the page is shown in a pop-up window, adding to the complexity of it.
2) Query the database for all the information and re-submit it. Seems like a lot of overhead, plus the data isn't freely available .. I'd rather not have to try to do this.
3) Use some other element of JMeter I'm not aware of to obtain the specific element data from the page. Maybe some listener I haven't figured out yet? If I could pull the parameters from the page and save them, that would be VERY convenient.
4) Somehow submit a POST request with only one field, specifying that I do not wish to clear out the remaining fields, I just want to leave them alone. I will freely admit that I am not super familiar with web applications so there may be a very obvious reason as to why this can't be done (or it's dependent on how its handled by the back-end of the application).
Thoughts?
From the whole post, I understand that you want to parameterise a field, where each time different value will be passed.
If my understanding is correct, the answer lies in CSV Dataset Config, where you can pass the values from a CSV file.
From your Example:
For an example, imagine I'm submitting some user data with fields for
Name, Email and Address. I want to change the name by adding a 1 to
the end of it and leave the other two fields as they are
To achieve this:
Steps to follows:
Create a csv file. fill the names as follows:
names
name1
name2
name3
name4
names is the column header and remaining are values.
Add CSV Dataset Config to your Test Plan.
Specify the file path.
replace the value in the name field in HTTP Post request as ${names}. that's it.
I would ask about capability to change the filed datatype from Single line to Multiline without delete this field.
Actually the CRM form editor is disable the data type option set after filed created, so I think I have to change the data type via Database
but I need to know if is it possible to do that, and if we change the data type from the database is it will change the filed from single line shape to multiline in the form.?
because my CRM is online so I need confirm is it possible, to ask Microsoft to do it for me.
Best regards .
It is not possible to convert a single line text field to a multi-line text field. Instead you should create a new multi-line text field and move the data from the old field to the new field.
If you were on-premise, you should not be making direct changes to the database (and there is no way Microsoft would be doing so for you online):
Modifying tables, stored procedures, or views in the database is not
supported.
Yes, as Henrik mentions, it's not possible, but tools can make it appear to be for all practical purposes ;)
The Attribute Manager (it's a plugin for the the XrmToolBox) will do this for you. It's in beta, so don't run it in prod without testing it in another environment first.
Just select your field, check Convert Attribute Type (optionally check Migrate Data if you want it migrated) and execute. You'll need to do it in each environment.
I am importing data from csv file in CRM2011, I was wondering if there a way to ignore a complete row, eg, if type = P then add if type = S then ignore?
Cheers
Using the Imports section of the Data Management area I think the only way you might have a chance at getting this to work is if you can control some other row value and make it invalid which would cause the entire row to fail on your type 'S' records.
Another alternative would be to use the SDK and create your own custom data mapping routine where are can have a bit more control over which records get processed.
SDK documentation
http://msdn.microsoft.com/en-us/library/hh547396.aspx
You could encourage CRM to consider the rows you're importing to be duplicates, or to be invalid lookups. Or you could accomplish this with workflow.
For example, if you mapped your 'type' field to an attribute, then made sure you had a record where that value is set to 'S', then set up a duplication rule to not allow records with non-unique 'type'.. that might work.
Or, you could try mapping 'type' to an Option Set which doesn't have a value for 'S' in it. This might work, or it might important blank, I'm not sure.
Or, you could make a workflow to retrospectively delete records where 'type' field is 'S'.
My disclaimer would be that none of these sound like particularly good ideas to me.
EDIT: another option is edit your CSV in Excel and remove the rows you don't want. That does sound like a good idea because then you're not asking the import wizard to do anything clever.