How to display the table data in ui page?

Hulk1
Giga Contributor

Table data:

{
  "userId": 1,
  "id": 1,
  "title": "delectus aut autem",
  "completed": false
  "userId": 2,
  "id": 2,
  "title": "delectus aut autem",
  "completed": false
  "userId": 3,
  "id": 3,
  "title": "delectus aut autem",
  "completed": true
}

How to retrieve these data from table and show it in ui page.
1 ACCEPTED SOLUTION

Nothing. Just update the html code with the one i gave and test it. In the html in this place you need to put your table name and add conditions if any using addQuery

<g:evaluate jelly="true">
		var gr = new GlideRecord('sys_user');
		gr.setLimit(3);
		gr.query();		
	</g:evaluate>

 

View solution in original post

11 REPLIES 11

asifnoor
Kilo Patron

Hi,

If you are referring to fetching data present in the table and showin in the html table in ui page then i suggest you check out existing ui pages. There are many OOB Ui pages which has similar features and you can try to replicate the same. you need to use jelly tags to loop through the data and show it on the ui page.

 

Hulk1
Giga Contributor

Thanks for your reply.can you send any real time example?

Hi,

Here is sample UI page code where i have fetched data from the database table and dispalyed it in html table format.

<?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 jelly="true">
		var gr = new GlideRecord('sys_user');
		gr.setLimit(3);
		gr.query();		
	</g:evaluate>
	<table border="1">
		<tr>
			<td>First Name </td>
			<td>Last Name</td>
			<td>Email </td>
		</tr>
	<g:for_each_record file="${gr}">
		<tr>
			<td>${gr.getValue("first_name")}</td>
			<td>${gr.getValue("last_name")}</td>
			<td>${gr.getValue("email")}</td>
		</tr>
	</g:for_each_record>
	</table>
</j:jelly>
	

Kindly mark the comment as a correct answer and also helpful if it has helped you to solve the problem.

Hulk1
Giga Contributor

What i need to put in script?