I am searching for a solution that would allow users to insert time values only in this format: hh:mm, and reject if something else is inserted. Something similar like data validation for date - Data validation -> Is valid date -> Reject input.
I tried to search and adjust a Regexmatch formula for this one, with no success, but I am open for other suggestions also.
Thank you in advance!
SUGGESTION
Perhaps you can try using a more specific regex such as the one sample from this existing post. Then, apply it your data validation via a custom function using REGEXMATCH function as seen here:
=REGEXMATCH(TO_TEXT(A1),"^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$")
Sample Data Validation Config:
Demo:
E.g. Any text or date formats won't be accepted.
use custom formula:
=REGEXMATCH(""&A1; "\d{2}:\d{2}")
if you want to block inputs like: 75:99 then try:
=REGEXMATCH(""&A1; "\d{2}:\d{2}")*((A1*1)<=1)
Related
I have a column in Google Sheets with values like 1(current), 2(current), etc. I am getting these values from google form response.
I want to extract only the integer from cell value as 1,2,3.. so on.
I am able to use SPLIT(A2, "(current)") for cells. But this does not get applied for new values from form response.
I found that ARRAYFORLMULA can be used for applying a formula to new responses from forms, but somehow it isn't working. I tried them as mentioned below, but I am not sure if I am using it correctly.
=ArrayFormula(QUERY( SPLIT(E2:E,"(current)")))
=ArrayFormula(SPLIT(E2:E,"(current)"))
Can someone help with how to achieve above answer with REGEXEXTRACT?
try like this:
=ARRAYFORMULA(IFNA(REGEXEXTRACT(E2:E, "\d+")))
I'm trying to execute a REST query to Yammer that will retrieve all threads (message starters) between a specified date AND time.
I noticed the search/search_tabs.json accepts "search_startdate/search_enddate" filters (though not documented) but not sure if the date is date-only or date/time.
While the messages.json has a "newer/older_than", but they accept ID's not date/time.
So I guess my question is:
Would the messages.json or search.json be more appropriate for this task?
Is there any additional documentation on search, the developer site just has "search - The search query." - what do these "queries" look like?
Thanks
-John
search_startdate and search_enddate only accept date inputs, not time or datetime inputs. I don't know if these are actually accessible through the API. To answer your questions:
1 - Neither will work for what you're trying to do
2 - I believe that the content of the search query is just the plaintext you want to look for, e.g., to search for "test" you would use https://www.yammer.com/api/v1/search.json?search=test
I'm trying to parse out the wishlist column in open cart's wishlist_to_store column to retrieve the product ID's. At first glance I thought it was being stored as JSON, but that obviously not the case. Is there a library or method I can use to parse it out?
Example wishlist:
a:2:{i:0;s:5:"16419";i:1;s:5:"16415";}
The method you are looking to use is called unserialize(). This is fairly similar in function to what JSON does but is the PHP equivalent. You can use it as follows
$a = unserialize('a:2:{i:0;s:5:"16419";i:1;s:5:"16415";}');
var_dump($a);
i want to group the output i am getting through date type. But i am storing the data in solr using datetime type. Date Format i am using is
Date format :: "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
For e.g. Date is stored in solr as "2013-03-01T20:56:45.000+00:00"
What i want as output is count of dates :: for .e.g.
Date1:: "2013-03-01T20:56:45.000+00:00"
Date2:: "2013-03-01T21:56:45.000+00:00"
Date3:: "2013-03-01T22:56:45.000+00:00"
Date3:: "2013-03-02T22:56:45.000+00:00"
Date4:: "2013-03-02T23:56:45.000+00:00"
So i want the output as two columns ::
Date Count
2013-03-01 3
2013-03-02 2
Here is the code i am using
String url = "http://192.168.0.4:8983/solr";
SolrServer server = new HttpSolrServer(url);
SolrQuery query = new SolrQuery();
query.setQuery("*:*");
query.addFilterQuery("sessionStartTime:[2013-03-01T00:00:00Z TO 2013-03-04T24:00:00Z]");
query.add("group", "true");
query.add("group.field","uniqueId"); // uniqueId is grouping the data
query.add("group.main","true");
query.setRows(9999);
QueryResponse rs=server.query(query);
Iterator<SolrDocument> iter = rs.getResults().iterator();
Help is appreciated.
I know that this is an older question but I am working on something related to this so I thought I would share my solution. Since you are using grouping, rs.getResults() will likely be null. After reading through the SolrJ API and doing some testing on my end, you will find that the results are indeed grouped as you want them to be. To access them, create a variable like such:
List<Group> groupedData = rs.getGroupResponse().getValues().get(0).getValues()
Note that Group is the class org.apache.solr.client.solrj.response.Group
Then, iterate through groupedData, usinig groupedData.get(i).getResult() to get a SolrDocumentList of results for each grouped value. In your example, (assuming the data is ordered as you said it would be), groupedData.get(0) would give you a SolrDocumentList of the three matches that have the date 2013-03-01.
I understand that this is quite the chain of method calls but it does end up getting the results to you. If anyone does know a faster way to get to the data, please feel free to let me know as I would like to know as well.
Refer to the API for GroupResponse for more information
Note that this answer is working on Solr 5.4.0
The output that you are trying to achieve, I believe is better suited to Faceting over grouping. Check out the documentation on Date Faceting more specifically and SolrJ fully supports faceting, see SolrJ - Advanced Usage. For an introduction to Faceting I would recommend reading Faceted Search with Solr
I have a long spreadsheet with tariff codes that I need to validate and I would like to create a function with RegEx to do it automatically (this is a daily task that I will have to do for the following months and I would like to automatize)
For example in Column A, I have the following data:
CODE
1000.00.00
1000.10.00
1020.12.99
...
But some times, the codes are mispelled like (1020..23.99 or 1020.23.124), and I would like to make a validation in column B with a function like this in each cell:
=isvalid_function(A2,"^\d{3,4}\.\d{2}\.\d{2}$")
..and get TRUE or FALSE as result.
You need to add the reference to Microsoft VBScript Regular Expressions to Excel, then you can use Regex, see this link for some more detail. Then you'd create a UDF called isvalid_function that would implement that.