- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2014 10:37 PM
Hi All,
I need to develop code for below shown format.
I got the day format using glide script and also got the date format in html. But its difficult to bind both of them in dynamic content and display.
Please suggest. I am a beginner for service now and not able to do this within timeline.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2015 10:36 PM
Hi Adam,
Sorry to reply late. I was so busy in work. Didn't check it.
Yes I got another way of doing this in Macro. Please reply if this is helpful. I have not tried Harish's code.
Code:-
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate>
var days = new Array('', 'Mon', 'Tues', 'Weds', 'Thurs', 'Fri', 'Sat', 'Sun');
var months = new Array('','01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
var dates = new Array('','01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31');
var datetoday = new GlideDateTime();
var today = days[datetoday.getDayOfWeek()];
var day1name = new GlideDateTime(gs.daysAgo(1));
var day1 = days[day1name.getDayOfWeek()];
var date1= months[day1name.getMonth()]+"-"+ dates[day1name.getDayOfMonth()];
var day2name = new GlideDateTime(gs.daysAgo(2));
var day2 = days[day2name.getDayOfWeek()];
var date2= months[day2name.getMonth()]+"-"+ dates[day2name.getDayOfMonth()];
var day3name = new GlideDateTime(gs.daysAgo(3));
var day3 = days[day3name.getDayOfWeek()];
var date3= months[day3name.getMonth()]+"-"+ dates[day3name.getDayOfMonth()];
var day4name = new GlideDateTime(gs.daysAgo(4));
var day4 = days[day4name.getDayOfWeek()];
var date4 = months[day4name.getMonth()]+"-"+ dates[day4name.getDayOfMonth()];
var day5name = new GlideDateTime(gs.daysAgo(5));
var day5 = days[day5name.getDayOfWeek()];
var date5=months[day5name.getMonth()]+"-"+ dates[day5name.getDayOfMonth()];
var day6name = new GlideDateTime(gs.daysAgo(6));
var day6 = days[day6name.getDayOfWeek()];
var date6= months[day6name.getMonth()]+"-"+ dates[day6name.getDayOfMonth()];
var day7name = new GlideDateTime(gs.daysAgo(7));
var day7 = days[day7name.getDayOfWeek()];
var date7=months[day7name.getMonth()]+"-"+ dates[day7name.getDayOfMonth()];
</g:evaluate>
<br/>
${day1}
${date1}<br/>
${day2}
${date2}<br/>
${day3}
${date3}<br/>
${day4}
${date4}<br/>
${day5}
${date5}<br/>
${day6}
${date6}<br/>
${day7}
${date7}<br/>
</j:jelly>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2014 03:52 AM
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<html>
<head>
<script>
function checkDetails()
{
var now = new Date();
var days = new Array('Sun','Mon','Tues','Weds','Thurs','Fri','Sat');
var months = new Array('01','02','03','04','05','06','07','08','09','10','11','12');
today = days[now.getDay()] + " " +months[now.getMonth()]+'-'+ now.getDate();;
yesterday = days[now.getDay()-1] + " " +months[now.getMonth()] + "-" +[(now.getDate()-1)] ;
day2 = days[now.getDay()-2] + " " +months[now.getMonth()] + "-" +[(now.getDate()-2)] ;
day3 = days[now.getDay()-3] + " " +months[now.getMonth()] + "-" +[(now.getDate()-3)] ;
day4 = days[now.getDay()-4] + " " +months[now.getMonth()] + "-" +[(now.getDate()-4)] ;
day5 = days[(now.getDay()-5)] + " " +months[now.getMonth()] + "-" +[(now.getDate()-5)] ;
var answer = day5+'@@'+day4+'@@'+day3+'@@'+day2+'@@'+yesterday+'@@'+today;
var answer = '12-14@@12-15@@12-16@@12-17@@12-18@@12-19@@12-20';
var record=answer.split('@@');
myFunction2(record);
}
function myFunction2(answer2)
{
var tbl = document.getElementById("tbl1");
var tBody = document.createElement("tbody");
var row = document.createElement("tr");
var coll1 = document.createElement("td");
var coll2 = document.createElement("td");
var coll3 = document.createElement("td");
var coll4 = document.createElement("td");
var coll5 = document.createElement("td");
var coll6 = document.createElement("td");
var coll7 = document.createElement("td");
var collText1 = document.createTextNode(answer2[0]);
var collText2 = document.createTextNode(answer2[1]);
var collText3 = document.createTextNode(answer2[2]);
var collText4 = document.createTextNode(answer2[3]);
var collText5 = document.createTextNode(answer2[4]);
var collText6 = document.createTextNode(answer2[5]);
var collText7 = document.createTextNode(answer2[6]);
coll1.appendChild(collText1);
coll2.appendChild(collText2);
coll3.appendChild(collText3);
coll4.appendChild(collText4);
coll5.appendChild(collText5);
coll6.appendChild(collText6);
coll7.appendChild(collText7);
row.appendChild(coll1);
row.appendChild(coll2);
row.appendChild(coll3);
row.appendChild(coll4);
row.appendChild(coll5);
row.appendChild(coll6);
row.appendChild(coll7);
tBody.appendChild(row);
tbl.appendChild(tBody);
}
</script>
</head>
<body onload="checkDetails()">
<!-- <input type="submit" value="DisplayDates" onClick="checkDetails()"/> -->
<span id="app">
<table id="tbl1" style="background-color:lemonchiffon" align="center">
<tr style="background-color:lightskyblue">
<th>Sunday</th>
<th>Monday</th>
<th>Tuesday</th>
<th>Wednesday</th>
<th>Thursday</th>
<th>Friday</th>
<th>Saturday</th>
</tr>
</table>
</span>
</body>
</html>
</j:jelly>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2014 04:30 AM
Again you have hard coded the date and Day values in body part. You have not used the calculated values in function.
I tried to modify. But not able to do so. Please help for few more steps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2014 04:40 AM
Dont you want to hard code this below code?
<tr style="background-color:lightskyblue">
<th>Sunday</th>
<th>Monday</th>
<th>Tuesday</th>
<th>Wednesday</th>
<th>Thursday</th>
<th>Friday</th>
<th>Saturday</th>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2014 09:58 PM
Hi Harish,
No I don't want the days to be hard coded. Dayname should happen as per the dates. This is also dynamic. As dates change dayname should also change.
Thanks a lot for your patiently reply.
Please one last favor to me if you can frame the code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2014 11:40 PM
Hi Harish,
The final goal.
1. Get the dynamic day names using function.(ex- sun, Mon........)
2. Get the dynamic months and date in MM-dd format using function.(ex- 12-7, 12-6................)
3. Get the values in table format(screenshot above).
4. Please help me as per this to frame the code. I have given you function for both.
I am not able to pass value for functions to get in table format. Please help.