Skip to content

Commit

Permalink
#1549 datetime missing values issue is fixed, missing values will be …
Browse files Browse the repository at this point in the history
…replaces, in old data view, download and data out api
  • Loading branch information
DavidBlaa committed Apr 10, 2024
1 parent bea42a9 commit 7f11d2a
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 16 deletions.
8 changes: 4 additions & 4 deletions Components/IO/BExIS.Io.Transform.Output/AsciiWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ protected override bool AddRow(DataRow row, long rowIndex, bool internalId = fal

if (variable != null)
{
string originalValue = value; //prepare to check against the missing values
//checking for display pattern
Dlm.Entities.DataStructure.DataType dataType = variable.DataType;
string format = GetStringFormat(variable.DisplayPatternId);
Expand All @@ -318,11 +319,10 @@ protected override bool AddRow(DataRow row, long rowIndex, bool internalId = fal
}
else value = value.ToString();

// checking for missing values
if (variable.MissingValues.Any(mv => mv.Placeholder.Equals(value)))
// checking for missing values against the original value
if (variable.MissingValues.Any(mv => mv.Placeholder.Equals(originalValue)))
{

value = variable.MissingValues.FirstOrDefault(mv => mv.Placeholder.Equals(value)).DisplayName;
value = variable.MissingValues.FirstOrDefault(mv => mv.Placeholder.Equals(originalValue)).DisplayName;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,13 @@ private HttpResponseMessage getData(DataTableSendModel command)
{
// apply selection and projection
long count = datasetManager.GetDataTuplesCount(datasetVersion.Id);
recieveModel.Count = count;

if(count==0) return Request.CreateErrorResponse(HttpStatusCode.BadRequest, "There is no data for the dataset.");

dt = datasetManager.GetLatestDatasetVersionTuples(id, filter, orderBy, null, command.Q, pageNumber, pageSize);
dt.Strip();

recieveModel.Count = datasetManager.RowCount(id, filter); // row count after filter

// replace column name to caption
for (int i = 0; i < dt.Columns.Count; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ private static List<string> CompareValues(StructuredDataStructure dataStructure)
foreach (var missingValue in variable.MissingValues)
{

if (DataTypeUtility.GetTypeCode(variable.DataType.SystemType) == DataTypeCode.DateTime && DataTypeDisplayPattern.Materialize(variable.DataType.Extra) != null)
if (DataTypeUtility.GetTypeCode(variable.DataType.SystemType) == DataTypeCode.DateTime && variable.DisplayPatternId>=0)
{
DataTypeDisplayPattern ddp = DataTypeDisplayPattern.Materialize(variable.DataType.Extra);
DataTypeDisplayPattern ddp = DataTypeDisplayPattern.Get(variable.DisplayPatternId);
DateTime dateTime;
if (DateTime.TryParse(missingValue.Placeholder, new CultureInfo("en-US", false), DateTimeStyles.NoCurrentDateDefault, out dateTime))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,19 @@
var kvpString = currentMVSArray[i];
var displayname = kvpString.split("|")[0]
var placeholder = kvpString.split("|")[1]
//console.log("c" + i + "-" + displayname + " - " + placeholder + " " + this.innerHTML);
console.log("pdatatest","c" + i + "-" + displayname + " - " + placeholder + " " + this.innerHTML);
//check if the value is a missing value and replace it
if (this.innerHTML.toUpperCase() == placeholder) {
this.innerHTML = displayname;
}
// check for dates
let v = this.innerHTML.toUpperCase();
if ((v.includes("9999") || v.includes("9998") || v.includes("9997")) && v.includes("31") && v.includes("12")) {
this.innerHTML = displayname;
}
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
//change event: if input change check also validation only on the field
// e.target.id is the id of the input component
function onChangeHandler(e) {
function onChangeHandler(e:any) {
// add some delay so the entityTemplate is updated
// otherwise the values are old
setTimeout(async () => {
Expand All @@ -137,7 +137,7 @@
//change event: if select change check also validation only on the field
// *** is the id of the input component
function onSelectHandler(e, id) {
function onSelectHandler(e:any, id:string) {
setTimeout(async () => {
res = suite(variable, id);
Expand All @@ -160,9 +160,7 @@
if(variable.unit == undefined || variable.unit == "")
{
console.log("🚀 ~ onChange ~ e.detail:", e.detail)
variable.unit = updateUnit(e.detail);
console.log("🚀 ~ e.detail ~ variable.unit:", variable.unit)
}
if(variable.description == undefined || variable.description == "" )
Expand Down Expand Up @@ -290,13 +288,13 @@
return []
}
function setValidationState(res) {
function setValidationState(res:any) {
isValid = res.isValid();
// dispatch this event to the parent to check the save button
dispatch('var-change');
}
function cutData(d) {
function cutData(d:any) {
for (let index = 0; index < d.length; index++) {
let v = d[index];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { templateListItemType, unitListItemType } from '../../types';

export function updateDisplayPattern(type, reset = true) {
// currently only date, date tim e and time is use with display pattern.
// however the serve only now datetime so we need to preselect the possible display pattern to date, time and datetime
// however the serve only now date time so we need to preselect the possible display pattern to date, time and date time
const allDisplayPattern = get(displayPatternStore);
let displayPattern: listItemType[];

Expand Down

0 comments on commit 7f11d2a

Please sign in to comment.