0
votes

I have a question, I got a view where I list all my Data. The Data has for example 3 entrys for the day 17.09.2018 but I just want to show only once the day 17.09.2018 and like in my example the ist Zeit and the Soll Zeit, Summe. I just want it to show it once for a day.

Example:

enter image description here

As you see here the days repeat and duplicated, like i sad before is there a way to show the summary of the day once?

Additional question: Is there a way to implement the days for example Monday - Friday ? Like the 17.09 is a Monday? and the 18.09 is a Tuesday ... ? in the backend is the date like 20180917 so not the regular date format because of the offset in the calendar I had to change it like this.

1
What control are you using?How does the data look like from the backend?If you can provide this info it would be helpful :)Shyam Babu
Backend is a EntitySet and look like 20180917, than i have a formatter and format it in this like above..Jünge alles

1 Answers

0
votes

You have to format the back-end output data you've got as per your requirement before applying to the model to the view. For example, for the additional question you've asked you can write the function to get the day from the date.

var yyyymmddToDay= function (yyyymmdd) {
    var dateInString = yyyymmdd.toString();
    var year = dateInString.substr(0,4);
    var month = dateInString.substr(4,2);
    var date = dateInString.substr(6,2);
    var dateFormat = year + "-" + month + "-" + date;
    var day = new Date(dateFormat).getDay();
    var weekDay;
    switch(day){
        case 0: 
            weekDay="Sunday";
            break;
        case 1 :
            weekDay="Monday";
            break;
        case 2: 
            weekDay="Tuesday";
            break;
        case 3 :
            weekDay="Wednesday";
            break;
        case 4 :
            weekDay="Thursday";
            break;
        case 5 :
            weekDay="Friday";
            break;
        case 6: 
            weekDay="Saturday";
            break;
    }
    return weekDay;
}

And for removing the duplicates from the data, just maintain an array, iterate through your data and then check if data item is present in the array, if present then don't add it otherwise do it. Thanks.