tying to add boolean values as timeseries gives error Time series is configured as numeric but used as a string or the other way around - palantir-foundry

I have IOT data that is coming from devices into foundry. I created the timeseries dataset and metadata as explained in the documentation https://www.palantir.com/docs/foundry/time-series/time-series-setup/#time-series-dataset
I have two datasets, one with double values that show up fine, but the dataset with value as string doesnt work.
As per the domumentation it says the Dataset itself should have cloumn type String for enum series .
Then it says that the metadataa should have is_enum which should be of type boolean
is_enum: This is an optional field for time series values that are expected in string format (ie Open/Close). Must be of type Boolean and is required to be true for series that are Enum types (otherwise is optional). This value should be consistent for a measure.
So in my metadata, for the series Id that have boolean value, I have is_enum set to true and datatype is boolean. Im able to create the time series sync. But I get the error that the time series is configured as numeric.

Related

MS Access Calculating date differences if Dates are Short Text

Is is possible in a Table to Calculate differences between Dates if the Value in the field is considered "short text"?
I am working to convert an Excel macro database into Access one and I have imported the data from the Excel file into an Access Table.
however i realized 2 feilds that count up until closure are now just fixed numbers but need to add up as each day passes until closure
when i imported the Dates became Short Text.
is there an expression that would handle this situation?
Each record has a serialized non repeating ID number seperate from access as well.
Dates I have are
OfficialissuanceDate,
DatePlanSubmitted,
DatePlanCompletedSubmitted,
DateClosed,
I need 2 calculations that increments daily when DateplanSubmitted and DatePlanCompletedSubmitted are null
Both comparing to OfficialIssuanceDate. then stop counting when they are no longer null. (have a date in updated to the record) and retain the value.
I have tried to Google calculating Dates but i get DateDiff function which doesnt appear to work. I've used Access and taken a class on it but never really made a new DB from scratch
Dates in a text field are not actual dates, just strings of characters. A Date/Time field stores value as a double number then displays in a date structure - "dd/mm/yyyy" is Access default structure.
Sometimes Access will do implicit conversion of data but not in this case. Either change field type to Date/Time or do conversion with CDate() function. However, you will find that conversion functions error with Null input.
Arithmetic operation with Date/Time field type is possible. However, arithmetic when any term is null returns Null so have to deal with that. One way uses Nz() function: Nz([DateClosed], Date()) - [DateOpened]. Unfortunately, Nz() is not available in table Calculated field type, so do that calc in query or textbox. Most developers avoid table Calculated field type. If you really want to use, expression would have to be: IIf(IsNull([DateClosed), Date(), [DateClosed]) - [DateOpened].

Update array column power automate flow

In my cloud flow, I need to check each of the date columns and update "ActiveDate" with the column name that is within 7 days of today's date.
So for the sample below I'd hope to populate ActiveDate with the value "Date1"
{
"RPTID": "RPT4072",
"Date1": "2021-07-02",
"Date2": "2021-09-17",
"Date3": "2021-10-22",
"Date4": "2022-02-25",
"Date5": "2022-05-20",
"Date6": "2023-03-07",
"ActiveDate": "",
"ProjectManager": "TBC",
"QuantitySurveyor": "Mr A / Mr B"
}
I feel like I'm going round in circles trying to figure out how to do this. I've tried IF syntax and also the Condition action but can't seem to get the correct logic. Any help is much appreciated.
Below is the source and SELECT from excel.
I have then added a loop and tried to update the date calculation with a variety of options and none have worked.
The screenshot above throws this error:
InvalidTemplate. Unable to process template language expressions in action 'Compose_2' inputs at line '1' and column '43252': 'In function 'formatDateTime', the value provided for date time string 'Date3' was not valid. The datetime string must match ISO 8601 format.'.
Here are a couple errors that let me on to trying the integer pointer above:
'The template language expression 'div(sub(ticks(formatDateTime(body('Select')[item()], 'yyyy-MM-dd')),ticks(formatDateTime(substring(utcNow(),0,10),'yyyy-MM-dd'))),864000000000)' cannot be evaluated because property 'Date1' cannot be selected. Array elements can only be selected using an integer index.
'The template language expression 'div(sub(ticks(formatDateTime(variables('dates')[item()], 'yyyy-MM-dd')),ticks(formatDateTime(substring(utcNow(),0,10),'yyyy-MM-dd'))),864000000000)' cannot be evaluated because property 'Date1' cannot be selected. Array elements can only be selected using an integer index.
Unable to process template language expressions in action 'Compose_4' inputs at line '1' and column '43252': 'The template language expression 'items('Apply_to_each')?[item()]' cannot be evaluated because property 'Date1' cannot be selected. Property selection is not supported on values of type 'String'
I feel like it needs some sort of item().value but for the life of me I can't get it..
The tricky part is to calculate the date difference for each date and then update the property in your json object.
Date Difference Calculation
div(sub(ticks(formatDateTime(variables('Result')[item()], 'yyyy-MM-dd')),ticks(formatDateTime(substring(utcNow(),0,10),'yyyy-MM-dd'))),864000000000)
Update Property in Json object
setProperty(variables('result'), 'ActiveDate', variables('FinalDate'))
Let's assume that you have your json object in a variable. I am initialising a variable Result for that. Apart from this you need one variable FinalDate for storing the desired date and another variable Dates for storing your 6 date keys.
Now you need to loop over all date keys and find the date difference for each date and check if it falls in the range -7 <= Dif <= 7. If yes assign the FinalDate object to that particular date. Check the image below.
Now you just need to update you original json object. You ca simply use setProperty method to do so as depicted below.

pyodbc returns extra decimal places for MS Access Double/Single fields

When I'm fetching data from my access database with pyodbc, it returns false format for float, date, or integers.
For example:
These values
Are returned like this
I've been searching for a long time now, I think it comes from the ODBC Driver used, but realy, I have no clue.
Another example would be a date like "21/01/2021" of type DATE in my MS Access DB, will be returned as a datetime in chinese or korean format YYYY-mm-dd H:m:s.
Floating-point columns (Numeric(Double) and Numeric(Single)) will display all decimal places in the Access UI if the field definitions in the table use the default formatting options
Format: (empty)
Decimal Places: Auto
Changing those settings to
Format: Fixed
Decimal Places: 2
will change the display format in the Access UI but the number itself will still be stored with its full precision. The ODBC driver does not pay attention to those formatting properties, so it returns the values with all available decimal places.
As for Date/Time values, the default format in the Access UI is to display just the date if the time component is exactly midnight. However the Date/Time value is stored with that time component (00:00:00) and again, the ODBC driver returns the complete value. See this answer for a more detailed explanation.

Assigning values to numbers in a text string using sql in mysql

This is an example of a string inserted into a mysql db field after a multiple choice checkbox form field has been submitted. (including the brackets): [1,0,1]
1=box checked
When the first number in the string = 1 value = pie, when the second number in this string =1 value= cookies, when the third number in this string =1 value = fruit. So the output for this string would be cookies, fruit.
I need to assign values to these numbers in an sql query. Something like:
select answer_data
from answers
where if the first number in the string = 1, the value is pie; if the 2nd number in the string = 1, the value is cookies;if the third number in the string=1, the value is fruit;
Caveat: Storing the data in this implied mapping to an array definition is a very brittle design. A better approach would be to just store the actual text values as JSON.
However, if you must use that approach...
If you defined a stored procedure
https://dev.mysql.com/doc/refman/8.0/en/create-procedure.html
You could use the Substring function to tease out the values - and assemble desired output
https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_substring

What's up with SSRS parameters and images?

I'm working on setting up a report in SSRS. Our report is somewhat flexible, and I'm looking to dynamically select an image for a cover page based on a parameter.
Here's what I have:
In our Reports db I have an image table set up. To keep things simple, lets just say I have three columns:
ImageName, ImageType, and Image.
Name and type are both varchar while ImageType is varbinary. I've uploaded the images we plan on using as well as their names and associated types to the table.
In my report I have a Data Source and a Dataset for bringing in the above table and columns.
I also have a parameter called "ImageName." I've set this parameter up to use "Image" (from the table described above) as its value field and the label field is set up for "ImageName."
On the report itself I have an image ... control? Report element? Not sure what to call it, but I've set up an image. The image source is set to "Database" and the MIME type uses the lookup function to pull the appropriate image type from the Dataset based on the Parameters!ImageName.Label argument - and that part works a treat - I'm returning the proper MIME type each time.
What doesn't work, and I would expect should work, is setting the image itself. For the "Use this field" field under "Select the image source:" I've tried both =Parameters!ImageName.Value with no success as well as a lookup based on the ImageName.Label from the images Dataset. Neither seem to work.
When I try using the parameter value, I'm getting the error
[rsInvalidDatabaseImageProperty] The value of the ImageData property
for the image 'ImageControlName' is "=Parameters!ImageName.Value",
which is not a valid ImageData.
I get essentially the same error message from the lookup method, it just swaps the lookup code for the Parameters!ImageName code above.
If I attempt to check the type returned by the lookup above I simply get an error. For the parameter if I check the type I get System.String so I decided to print that out and apparently the value of Parameters!ImageName.Value is System.Byte[] for some reason.
I can get an image to display using the First() function, but I need to be able to select the image. I'm guessing I may have to filter. First() has a return type of System.Byte[], which seems reasonable. I just don't understand why my parameter is returning the type of the image data column as a string rather than the data from the image column itself.
So how do I get this working? Is filtering my Dataset my only option? Or is there a way to get the parameter working or to get some function that will allow me to select the appropriate image?
Reason for your error is because of the data types returned by Parameters vs First.
For the Parameters data type returned is of type text and which is not valid image data type hence the error.
For First function it returns the data type based on type of expression and it returns the right type of data type for image and displays the image.
Per Microsoft Parameter Data Type:
A report parameter must be one of the following data types:
Boolean. The user selects True or False from a radio button.
DateTime. The user selects a date from a calendar control.
Integer. The user types values in a text box.
Float. The user types values in a text box.
Text. The user types values in a text box.
When available values are defined for a parameter, the user chooses
values from a drop-down list, even when the data type is DateTime.
Per Microsoft First function data type:
Return Type
Determined by the type of expression.
You are correct to get the right image you need to filter the dataset.
Create dataset which gives ImageName, ImageType, and Image.
Based on image parameter filter the dataset on ImageName.
Now use the following expression to get the correct image data.
=Fields!Image.Value