HTML report

What would you like to see in CSPro?
Forum rules
New release: CSPro 8.0
Post Reply
dabwil
Posts: 21
Joined: January 7th, 2021, 11:33 am

HTML report

Post 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
aaronw
Posts: 561
Joined: June 9th, 2016, 9:38 am
Location: Washington, DC

Re: HTML report

Post 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 7367 times
htuser
Posts: 631
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

Re: HTML report

Post 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
G.VOLNY, a CSProuser from Haiti, since 2004
Post Reply