Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 19 APR 2023 12:41:12AM Barry Stevens wrote:

I have a table(EditTable) on a form and I want to add rows and data to the table.

I have this test code, but how do I get the tablename as it does not appear to be the element name, or, am I still missing something.

	tableName='element24'

				

				

					

				Num.values = dcount(myData, @fm)

				For each.value = 1 to num.values

					this.job = myData<each.value>

					*O4WTextbox(this.job, "", "", "JOB_DETAILS", "JOB_":EACH.VALUE)

					O4WTableAddRow(tableName, each.value, "JOB_":EACH.VALUE)

					O4WSetCell(each.value, 1,tablename)

					O4WUpdate(tablename, this.job, O4WResponseOptions("1"))

					o4wbutton("Select","BTN_SEL_":each.value)

					o4wqualifyevent("BTN_SEL_":each.value,"CLICK")

				Next each.value

At 19 APR 2023 08:57AM bshumsky wrote:

Hi, Barry.

It looks like you want to populate the table entirely from code - is that correct?

If that's the case, then I'd suggest you're better off creating the table from scratch. Although the O4WCommuterUtility will give you the name of the table associated with the element, and O4WTableAddRow will add in a blank row, I don't think you can use O4WUpdate in this fashion. Instead, you can use O4WCommuterUtility to get the name of the table and the name of the "section" that surrounds the element, and then use O4WTableStart/O4WTableEnd to make the entire table as you wish.

I _think_ something like this will work:

sectValue = O4WCommuterUtility("", O4WUTILITY_FORMELEMENT_CONTROL_CELL$, "element24")

If sectValue <> "" Then

tblValue = O4WCommuterUtility("", O4WUTILITY_TABLENAME$, "element24")
If tblValue <> "" Then
	O4WSectionStart(sectValue, O4WResponseStyle())
	O4WTableStart(tblValue)
  • build your table here
	O4WTableEnd(tblValue)
	O4WSectionEnd(sectValue)
end

end

There may be some extra 'tweaks' to the above, but that's the general idea I think…

- Bryan Shumsky

Revelation Software, Inc.


At 19 APR 2023 07:18PM Barry Stevens wrote:

Hi, Barry.

It looks like you want to populate the table entirely from code - is that correct?

If that's the case, then I'd suggest you're better off creating the table from scratch. Although the O4WCommuterUtility will give you the name of the table associated with the element, and O4WTableAddRow will add in a blank row, I don't think you can use O4WUpdate in this fashion. Instead, you can use O4WCommuterUtility to get the name of the table and the name of the "section" that surrounds the element, and then use O4WTableStart/O4WTableEnd to make the entire table as you wish.

I _think_ something like this will work:

sectValue = O4WCommuterUtility("", O4WUTILITY_FORMELEMENT_CONTROL_CELL$, "element24")

If sectValue <> "" Then

tblValue = O4WCommuterUtility("", O4WUTILITY_TABLENAME$, "element24")
If tblValue <> "" Then
	O4WSectionStart(sectValue, O4WResponseStyle())
	O4WTableStart(tblValue)
  • build your table here
	O4WTableEnd(tblValue)
	O4WSectionEnd(sectValue)
end

end

There may be some extra 'tweaks' to the above, but that's the general idea I think…

- Bryan Shumsky

Revelation Software, Inc.

..you're better off creating the table from scratch.

That was my thinkinking also by using the table as a placemarker.

Looks like I need to study up on these moving forward for the complete app development:

O4WUTILITY_FORMELEMENT_CONTROL_CELL$, O4WUTILITY_TABLENAME$

as all my data fills are not directly from oi tables, but are assembled.

Thanks for the continuing heads-up

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/ecfe6c7f7ed53d4e8ce48d57482c5b72.txt
  • Last modified: 2024/05/23 12:38
  • by 127.0.0.1