Cannot retrieve data from self-added slot by Forms

Post Reply
xiaoqi
Posts: 148
Joined: 09 Feb 2023, 03:33

Hello,

I'm facing one issue in "Project Summary" view but the reason can be generic, below I try to explain in detail:

I've used "Change_Activity > Project" to track our on-hand projects, the default slots are working fine.

Recently, our project review would like to see more specific background of a project, e.g. "Drivers for Change", "Initiative Objectivies" etc.., thus, I don't want to mix all of them in one single "Description" slot which cannot easily distinguish among them.

So, learnt from University documentation, I created three new slots as below first:
  • project_drivers_for_change
  • project_initiative_objectives
  • project_provided_value
All of them are using default "at most = 1", "Types=:ESSENTIAL-SLOT", "Value Type=String", and specifically "Domain=Project", see attached image: essential-project-form-00.png

Then I use "Project" Forms tab, to place them under "Description" slot, and all of them select "Widget Type = TextAreaWidget", see attached image: essential-project-form-01.png

After that, I add following lines in file "enterprise > core_el_project_summary.xsl":

Code: Select all

<!-- "WHY" Page -->
<xsl:variable name="projectDriversForChange" select="/node()/simple_instance[name = $this/own_slot_value[slot_reference = 'project_drivers_for_change']/value]"/>
<xsl:variable name="projectInitiativeObjectives" select="/node()/simple_instance[name = $this/own_slot_value[slot_reference = 'project_initiative_objectives']/value]"/>
<xsl:variable name="projectProvidedValue" select="/node()/simple_instance[name = $this/own_slot_value[slot_reference = 'project_provided_value']/value]"/>
Use first one as sample below, other two are same layout:

Code: Select all

<!--Setup "Drivers for change" Section-->
<div class="col-xs-12">
	<div class="sectionIcon">
		<i class="fa fa-list-ul icon-section icon-color"/>
	</div>
	<h2 class="text-primary">
		<xsl:value-of select="eas:i18n('Drivers for Change')"/>
	</h2>
	<div class="content-section">
		<div id="projdriver"/>
	</div>
	<hr/>
</div>
Add below within

Code: Select all

var project = {}
:

Code: Select all

"projectDriver":"<xsl:value-of select="$projectDriversForChange"/>",
"projectObj":"<xsl:value-of select="$projectInitiativeObjectives"/>",
"projectValue":"<xsl:value-of select="$projectProvidedValue"/>",
And load those definition in below lines:

Code: Select all

$('#projdriver').html(project.projectDriver);
$('#projobjective').text(project.projectObj);
$('#projvalue').text(project.projectValue);
All of those are my added code, but no matter I update the content or not, the view cannot load the value of the slot. See attached picture: essential-project-form-02.png.

Are there any steps I miss to populate my self-added slot to the view?

Thanks greatly,
Xiaoqi
You do not have the required permissions to view the files attached to this post.
xiaoqi
Posts: 148
Joined: 09 Feb 2023, 03:33

Here I also attached the updated xsl file for your review.
You do not have the required permissions to view the files attached to this post.
xiaoqi
Posts: 148
Joined: 09 Feb 2023, 03:33

Hello again,

Just updates that I think I found one tricky way to solve the issue.

I've compared the way of treaing the "Description" slot, which the source code is

Code: Select all

common\core_utilities.xsl
, and tried mirroring the approach for my three new slots, the reason I don't have data loaded to the viewer should be due to they're the "textbox", not the instance.

See below as the code in the "core_el_project_summary.xsl" I've added for one of the slot which learning from "description:

Code: Select all

                         "projectDesc":"<xsl:call-template name="RenderMultiLangInstanceDescription">
							<xsl:with-param name="isRenderAsJSString" select="true()"/>
							<xsl:with-param name="theSubjectInstance" select="$this"/>
						</xsl:call-template>",
			 "projectDriver":"<xsl:call-template name="RenderMultiLangInstanceDriversForChange">
							<xsl:with-param name="isRenderAsJSString" select="true()"/>
							<xsl:with-param name="theSubjectInstance" select="$this"/>
						</xsl:call-template>",
Now those filled-in text can be shown in the view.

Would like to hear if there're any other smarter method, thanks.
Xiaoqi
JohnM
Posts: 538
Joined: 17 Feb 2009, 20:19

There is a function for calling slot values:

<xsl:call-template name="RenderMultiLangInstanceSlot">
<xsl:with-param name="theSubjectInstance" select="current()"/>
<xsl:with-param name="displaySlot" select="slot name"/>
<xsl:with-param name="isForJSONAPI" select="false()"/>
</xsl:call-template>

note the slot name must be in single quotes within the double quotes

That should work.
xiaoqi
Posts: 148
Joined: 09 Feb 2023, 03:33

Thansk John, I'll test this way in my code.
Post Reply