I am trying get a total from completions by date, but conversions don't have dimension date, actually the query is
https://www.googleapis.com/analytics/v3/data/ga?ids=ga%xxxxxx&start-date=2013-10-20&end-date=2013-11-20&metrics=ga%3AgoalStartsAll%2Cga%3AgoalCompletionsAll%2Cga%3AgoalValueAll%2Cga%3AgoalValuePerSession%2Cga%3AgoalConversionRateAll&dimensions=ga%3AgoalCompletionLocation&max-results=10
Did you try use Query Builder?
https://ga-dev-tools.appspot.com/query-explorer/
You can select ga: date and ga: goalCompletionsAll
https://ga-dev-tools.appspot.com/query-explorer/?start-date=30daysAgo&end-date=yesterday&metrics=ga%3AgoalCompletionsAll&dimensions=ga%3Adate
#get report data
query.list <- Init(start.date = "XXXXXX",
end.date = "XXXXXX",
dimensions = "ga:date",
metrics = "ga:goalXXCompletions",
table.id = "ga:XXXXX")
Related
I have a text search based on a text index of my mongodb collection 'locations' so a user can search for results based on town/city.
and I also have a dropdown select where user can select a 'type'.
both functions return the desired result, but they both work independently. I don't know enough to understand how to combine them and render the results. Any help much appreciated.
#app.route("/search")
query = request.form.get("query")
search = mongo.db.properties.find({"$text": {"$search": query}})
Dropdown Filter:
#app.route("/search", methods=["GET", "POST"])
def search():
# query the database for all property types
featured = mongo.db.properties.find()
types = mongo.db.type.find()
query = request.form.get("query")
filtered_result = []
# gets property type input from dropdown select and renders results
if request.method == "POST":
property_types = request.form.get("propertytype")
filtered_result = list(mongo.db.properties.find({'property_type' : property_types}))
return render_template("properties.html", types=types, properties=filtered_result, featured=featured)
I have two different date types in my table: the first is simple YYYY-MM-DD, the second contains the week number and year.
How is it possible to build an IFS formula, where these two date types are conditions? Like:
=IFS(A1="YYYY-MM-DD", "A", A1="WWYYYY", "B")
You may simply use following formula:
=IFS(LEN(A1)=10,"A",len(A1)=6,"B")
I didn't see Google Sheets Data Format WWYYYY then I assumed that you have text values. If it's true then you can try REGEXMATCH
=IFS(REGEXMATCH(J8,"\d{4}-\d{2}-\d{2}"), "A",REGEXMATCH(J8,"\d{6}"), "B")
But for me I will not save Dates as text. It requires a script
/**
*
* #customformula
*/
function PATTERN_EXTRACTOR(pattern, a1Notations) {
var patt = new RegExp(pattern, 'gi');
var range = SpreadsheetApp.getActiveSheet().getRange(a1Notations);
return range.getDisplayValues().map(function(row) {
return row.map(function(cell) {
return cell.replace(patt,'X');
});
});
}
Getting pattern
=PATTERN_EXTRACTOR("\d",CELL("address",I8))
Resolve conditions
=IFS(I10="XXXX-XX-XX", "A",I10="XXXXXX", "B")
this could work too:
=ARRAYFORMULA(IF(IFERROR(DATEVALUE(A1:A5)), "A",
IF(ISNUMBER(A1:A5), "B", )))
I'm trying to build a query for all orders which were created today.
My Order-Entity has a datetime field like this:
#Column(name = "OrderCreationDate")
#Temporal(TemporalType.TIMESTAMP)
private Date orderCreationDate;
Named-Query:
#NamedQuery(name = "OrderHeader.findByOrderCreationDate", query = "SELECT o FROM OrderHeader o WHERE o.orderCreationDate = :orderCreationDate")
I tried to build the query like this:
public List<OrderHeader> findFromToday() {
Date dateToday = new Date();
TypedQuery<OrderHeader> query = em.createNamedQuery("OrderHeader.findByOrderCreationDate", OrderHeader.class).setParameter("orderCreationDate", dateToday);
return query.getResultList();
}
Of course the ResultList is empty since the date AND time would have to match.
Unfortunately I need the time in my database, so the orderCreationDate needs to stay datetime/timestamp.
So how can I query for a specific date, ignoring the time?
thanks!
Your call to setParameter needs to pass in the temporal type argument also, defining what to use for comparison.
http://www.datanucleus.org/javadocs/javax.persistence/2.1/javax/persistence/Query.html#setParameter-java.lang.String-java.util.Date-javax.persistence.TemporalType-
I am trying to create a Filter that will that will return the rows where at least one minute has passed from the stored transactionDate. I am not getting an error but it is not returning any rows. The transactionDate is a timestamp in MongoDB and is stored as "transactionDate" : ISODate("2016-09-30T20:29:19.448Z")
Thanks! \m/ \m/
var filter = Builders<MyDocument>.Filter.Eq("Genre", "Rock");
filter = filter & (Builders<MyDocument>.Filter.Lt(x => x.transactionDate, DateTime.Now.AddSeconds(Math.Abs(60) * (-1))));
using (var cursor = await MyCollection.Find(filter)
.Sort(Builders<MyDocument>.Sort.Ascending(x => x.artist).Ascending(x => x.rating)).ToCursorAsync())
{
// foreach...
}
The above code actually does work. I had an issue in the data causing no results to be returned. \m/ \m/
I'm using Scalaquery and have run into a problem when I attempt to limit my query based on a date field. I'm using Scala 2.9.2, ScalaQuery 2.9.1:0.10.0-M1 Consider the code below:
case class MyCase (opr_date: Date)
object MyClass extends BasicTable[MyCase]("MYTABLE") {
def opr_date = column[Date]("OPR_DATE")
def * = opr_date <> (MyCase, MyCase.unapply _)
def test(date: Date) = db.withSession {
logDebug("test date: " + date)
val qry = for {
d <- MyClass if (d.opr_date === date)
} yield d.opr_date
logDebug(qry.selectStatement)
qry.list
}
}
This query never returns any rows. Here is the calling code:
"The data" should {
"be available " in {
val testDate = CommonFormat.parseDate("2012-10-27", CommonFormat.EURO_SHORT).getTime
val records = MyClass.test2(new java.sql.Date(testDate))
records.size must be_>(0)
}
}
The query returns 0 rows and produces the following SQL when I print the select:
SELECT "t1"."OPR_DATE" FROM "MYTABLE" "t1" WHERE ("t1"."OPR_DATE"={d '2012-10-27'})
I have data available for the test date. If I paste the SQL into a SQL editor and edit the date so that its not the JDBC template format ('27-Oct-2012') the query returns the expected rows. Can anyone tell me what I'm doing wrong? Shouldn't this work?
I found out this morning that this was a data problem. The query works fine. It turns out I was connecting to the wrong server. We have a confusing setup of multiple environments and back-up systems that share the same database name. After connecting to the correct server the query works as expected. I saw different results between my code and the editor-tool because they were pointing at different servers (same database name ugh).Thank you to all who took time to look into this for me. I appreciate your efforts.