Page 1 of 1

HTML report

Posted: February 4th, 2023, 10:05 am
by dabwil
Bonjour cher tous. Je voulais rédiger un rapport HTML. Ce rapport doit pouvoir afficher les roster avec les données. Comme sur le questionnaire papiers. Comment écrire celà.

Cordialement

Re: HTML report

Posted: February 13th, 2023, 4:10 pm
by aaronw
I made a few modifications to the existing report in the CAPI Census example. Here's a snippet of the report code.

Code: Select all

	<!-- Report content -->
	<table class="table table-striped table-bordered">
		<thead>
			<tr>
				<th>Name</th>
				<th>Relationship</th>
				<th>Sex</th>
			</tr>
		<? do numeric ctr = 1 while ctr <= count(PSC_HOUSEHOLD_DICT.POPULATION_RECORD) ?>
			<tr>
				<td>~~strip(HH_NAME(ctr))~~</td>
				<td>~~getlabel(HH_RELATIONSHIP_WITH_HEAD_VS, HH_RELATIONSHIP(ctr))~~</td>
				<td>~~getlabel(HH_SEX_VS1, HH_SEX(ctr))~~</td>
			</tr>
		<? enddo; ?>
		</thead>
	</table>
The only other change was to load a household case before calling the report via loadcase. The result looks like this:
roster-report.PNG
roster-report.PNG (13.07 KiB) Viewed 8092 times

Re: HTML report

Posted: February 13th, 2023, 10:48 pm
by htuser
Thanks Aaron! It's exactly the same way that I did using latest CSPro 7.7 HTML new report features. Before this. It was more time consuming using file.write.

@Dabwil, pour completer Aaron, vous pouvez jeter un coup d'oeil sur mon post dans le sujet: viewtopic.php?p=14470#p14470 et telecharger un example de resultats ici: download/file.php?id=1878
Et aussi quelques explications ici: viewtopic.php?p=11491&hilit=print#p11491

Best