[default#keyspace] get fv['user:/file.txt'];
=> (super_column=1365647977415,
(column=6363, value=0000000000000001, timestamp=1368238637628082)
(column=6c6d64, value=0000013f79344eb2, timestamp=1368238637628081)
(column=7362, value=000000000000003a, timestamp=1368238637628083))
=> (super_column=1365653962252,
(column=6363, value=0000000000000001, timestamp=1368238637727277)
(column=6c6d64, value=0000013f798fbee6, timestamp=1368238637727276)
(column=7362, value=0000000000000045, timestamp=1368238637727278))
del fv['user:/file.txt'][1365647977415];
column removed.
get fv['user:/file.txt'];
=> (super_column=1365647977415,
(column=6363, value=0000000000000001, timestamp=1368238637628082)
(column=6c6d64, value=0000013f79344eb2, timestamp=1368238637628081)
(column=7362, value=000000000000003a, timestamp=1368238637628083))
=> (super_column=1365653962252,
(column=6363, value=0000000000000001, timestamp=1368238637727277)
(column=6c6d64, value=0000013f798fbee6, timestamp=1368238637727276)
(column=7362, value=0000000000000045, timestamp=1368238637727278))
How is this possible? Comparator is ByteType, I used
assume fv comparator as LongType;
The problem was in the column timestamp which was newer than now. Be careful, guys.
=> (super_column=1365647977415,
(column=6363, value=0000000000000001, timestamp=1368238637628082)
1368238637628082 == Sat, 11 May 2013 02:17:17 GMT
Now is Thu, 11 Apr 2013 07:10:36 GMT
Related
Here is some sample data provided by a cosmosdb which contains JSON :
[
{
"Name":"ABC",
"ID":20,
"Category":"IT",
"training_cycles": [
"Jan 01, 2022 → Jun 30, 2022",
"Jul 01, 2021 → Dec 31, 2021"
]
},
{
"Name":"John",
"ID":25,
"Category":"Comp",
"training_cycles": [
"Jan 01, 2022 → Jun 30, 2022"
]
},
{
"Name":"XYZ",
"ID":23,
"Category":"HR",
"training_cycles": [
"Jan 01, 2022 → Jun 30, 2022"
]
}
]
Id like to ask azure data factory to select items which contain "Jul 01, 2021 → Dec 31, 2021" within "training_cycles".
So far, in my data flow, i have selected all my items and filtered to only see training_cycles... so my data only has 1 "column" called training_cycles and many items which contain these training_cycles.
I tried filtering with :
contains(training_cycles, "#training_cycles" == "Jul 01, 2021 → Dec 31, 2021")
but it selects all the data instead of only the items which contain the right data.
Thanks for the help
I tried to reproduce your issue.
My sample json
[
{
"Name":"ABC",
"ID":20,
"Category":"IT"
},
{
"Name":"John",
"ID":25,
"Category":"Comp"
},
{
"Name":"XYZ",
"ID":23,
"Category":"HR"
}
]
Source Settings Data preview
Then I used Filter Row Modifier. Here In Filter On condition I used Name==’ABC’. In your case you can use training_cycles == "Jul 01, 2021 → Dec 31, 2021"
Expected Result in Data preview
I need to filter data using to get specific data for the timestamp match.
For example I need the data where arrivalTime matches with exact date and time fields, timestamp field in database.
I am trying below but it returns no data.
_arrivalTIme = moment(
`${todaysDate.format('YYYY/MM/DD')} ${_arrivalTIme}:00`,
).toDate();
// _arrivalTIme: Thu May 28 2020 09:00:00 GMT-0600 (Mountain Daylight Time)
return firestore()
.collection('mainCol')
.doc(todayDate)
.collection('subCol')
.where('arrivalTime', '==', `${_arrivalTIme}`) ...
my db record looks like this:
What am I doing wrong?
You're comparing a date field in your database with a string from your code. That comparison will never be true.
You'll either need to get a Timestamp value that is exactly the same as the value in the database, or (more commonly) do a range check:
return firestore()
.collection('mainCol')
.doc(todayDate)
.collection('subCol')
.where('arrivalTime', '>=', new Date('2020-05-28 08:00:00')
.where('arrivalTime', '<', new Date('2020-05-28 08:01:00')
I have a mongoDB database in which one field is an ISO date.
When i query the table using a graphql (node) query i receive my objects back all right but the date format i see in graphiql is in this weird format:
"created": "Sun Nov 26 2017 00:55:35 GMT+0100 (CET)"
if i write the field out in my resolver is shows:
2017-11-25T23:55:35.116Z
How do i change the date format so it will show ISO dates in graphiql?
the field is just declared as a string in my data type.
EDIT
My simple type is defined as:
type MyString {
_id: String
myString: String
created: String
}
When I insert a value into the base created is set automatically by MongoDB.
When I run the query it returns an array of obejcts. In my resolver (for checking) I do the following:
getStrings: async (_, args) => {
let myStrings = await MyString.find({});
for (var i = 0; i < myStrings.length; i++) {
console.log(myStrings[i]["created"]);
}
return myStrings;
}
all objects created date in the returned array have the form:
2017-11-25T23:55:35.116Z
but when i see it in GraphIql it shows as:
"created": "Sun Nov 26 2017 00:55:35 GMT+0100 (CET)"
my question is: Why does it change format?
Since my model defines this as a String it should not be manipulated but just retain the format. But it doesn't. It puzzels me.
Kim
In your resolver, just return a formatted string using toISOString()
const date1 = new Date('2017-11-25T23:45:35.116Z').toISOString();
console.log({date1});
// => { date1: '2017-11-25T23:45:35.116Z' }
const date2 = new Date('Sun Nov 26 2017 00:55:35 GMT+0100 (CET)').toISOString();
console.log({date2})
// => { date2: '2017-11-25T23:55:35.000Z' }
UPDATED to answer the added question, "Why does [the date string] change format"?
Mongo does not store the date as a string. It stores the date as a Unix epoch (aka Unix time, aka POSIX time), which is the number of seconds that have elapsed since January 1, 1970 not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z). Since your data model requests a string, it'll coerce the value using toString()
const date1 = new Date('2017-11-25T23:45:35.116Z').toString();
console.log({date1})
// => { date1: 'Sat Nov 25 2017 15:45:35 GMT-0800 (PST)' }
That should clarify the behavior for you, but what you probably really want to do is change your model so that created is properly typed as a Date. You can do this a couple ways.
Create a custom scalar
GraphQLScalarType
Creating custom scalar types
Or use an existing package that already does the above for you
graphql-date
graphql-iso-date
You just need to do step by step:
Set type of your field is Object
Insert line scalar Object into your .graphql file
Add dependence graphql-java-extended-scalars into pom.xml file
Add syntax .scalar(ExtendedScalars.Object) in buildRuntimeWiring function
Let try it.
I try it and successful!
I've got this function which is used to get the closing values for stock on hand in a SSAS cube. My problem is, is that this doesn't work when in Excel, multiple items are selected.
From what I've read, this is to do with Excel using Subcubes and the query context not being correct. I've seen that Dynamic Sets are the way to fix this, however I have no idea how to implement this.
WITH
MEMBER [Measures].[Closing Stock Date] AS
IIF
(
Ancestor
(
StrToMember
(
'[Date].[Retail].[Date].&[' + Format(Now(),'yyyy-MM-dd') + 'T00:00:00]'
)
,[Date].[Retail].CurrentMember.Level
)
IS
[Date].[Retail].CurrentMember
,StrToMember
(
'[Date].[Retail].[Date].&[' + Format(Now(),'yyyy-MM-dd') + 'T00:00:00]'
)
,ClosingPeriod
(
[Date].[Retail].[Date]
,[Date].[Retail].CurrentMember
)
).Name
SELECT
{[Measures].[Closing Stock Date]} ON COLUMNS
FROM
(
SELECT
{
[Date].[Retail].[Retail Period].&[Period 1, Ret 2014]
,[Date].[Retail].[Retail Period].&[Period 2, Ret 2014]
,[Date].[Retail].[Retail Period].&[Period 3, Ret 2014]
,[Date].[Retail].[Retail Period].&[Period 4, Ret 2014]
,[Date].[Retail].[Retail Period].&[Period 11, Ret 2014]
,[Date].[Retail].[Retail Period].&[Period 12, Ret 2014]
} ON COLUMNS
FROM [Retail]
)
WHERE
[Business Division].[Business Division].&[11];
What do I need to change to get the Measure using the correct query context with named sets and return the correct results?
Change your StrToMembers to StrToSets.
There doesn't seem to be any details about this in the forms api. So please forgive my question, but I need to know what is being returned when i submit values from a form field where I can select multiple values. I suspect it is an array, if so, how is it structured? Thanks.
Here is a dump of the value field from the $form_state variable after submission for a form that contains 2 multiple select lists. *Countries and Currencies. As you can see, you are correct, an array of values corresponding to the selected option values is returned for each of the 2 lists:
[values] => Array
(
[name] => PayPal
[ppid] => 17
[countries] => Array
(
[236] => 236
[237] => 237
)
[currencies] => Array
(
[USD] => USD
[EUR] => EUR
[CAD] => CAD
)
[submit] => Submit Details
[form_build_id] => form-d675700e434f656b0e1c7ac4aa91a210
[form_token] => 3405b88547c068a0f6a2742670b2149a
[form_id] => add_payment_method_form
[op] => Submit Details
)