form with following fields:
Code Block |
---|
Location:
Date:
Set1
Set2
Set3 |
...
ConfiForms Form Definition |
---|
formName | f |
---|
allowReads | true |
---|
export | true |
---|
|
locationLocationtext mydateDatedate set1Set 1text set2Set 2text set3Set 3text sashtrue
|
All records
ConfiForms TableView |
---|
|
location mydate set1 set2 set3 |
...
Code Block |
---|
https://wiki.vertuna.com/ajax/confiforms/rest/filter.action?pageId=23265387&f=f&q=&sort=mydate%20ASC
https://wiki.vertuna.com/ajax/confiforms/rest/filter.action?pageId=23265387&f=f&q=&fields=set1,set2,set3,mydate.formatDate(w),mydate&sort=mydate%20ASC |
Report is loaded with JavaScript and ConfiForms REST API
HTML |
---|
<div id="confiReport"></div>
<script>
AJS.toInit(function() {
var isPageEdit = AJS.$('#content').hasClass('page edit');
if (!isPageEdit) {
var url = 'https://wiki.vertuna.com/ajax/confiforms/rest/filter.action?pageId=23265387&f=f&q=&sort=mydate%20ASC';
var xhr = AJS.$.ajax({
url: url,
timeout: 10000, // 10 sec
success: function (data) {
var currentWeek = confimoment().format('W');
var runningWeek = null;
var rows = data.list.entry;
for (i=0;i<rows.length;i++) {
var recordWeek = console.logconfimoment(new Date(rows[i].fields.mydate)).format('W');
console.log(confimoment(new Date(rows[i].fields.mydate)).format('W'));
if (runningWeek == null || runningWeek != recordWeek) {
AJS.$('#confiReport').append('<h2>' + ((recordWeek == currentWeek ) ? 'Current week' : ( recordWeek + ' week')) + '</h2>');
}
AJS.$('#confiReport').append('<p> Set1: ' + rows[i].fields.set1 + '</p>');
AJS.$('#confiReport').append('<p> Set2: ' + rows[i].fields.set2 + '</p>');
AJS.$('#confiReport').append('<p> Set2: ' + rows[i].fields.set2 + '</p><br/>');
runningWeek = recordWeek;
}
console.log(data);
},
error: function (jqXHR, textStatus, errorThrown) {
console.log('request to get data from ConfiForms has failed... ' + textStatus);
}
});
}
});
</script>
|
Storage format for this solution