Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Dynamic Workflow
abhishek_gupta
Hi,
I need to have a drop down in my wft, which is populated dynamically with the values in the database. Can any one help me out with a snippet of code.
Thanks in advance.
AK
Find more posts tagged with
Comments
Migrateduser
What database are you getting the values from?
abhishek_gupta
We are using Oracle database. But the DB should not make much of a difference.
AK
Interwoven Consultant
Bubas_IWOV
Hi,
Were in the workflow you need the drop down?
Because if is the initial cgi task, then you just need to install the perl modules DBi and DBD and then use them to connect to the DB and use normal select statments to fill your drop downs.
Regards
Bruno
abhishek_gupta
Thanks Bruno.
I think we should have this CGI task as the first task, since it has to populate the drop-down in the Workflow GUI.
First what I need to do is pass a parameter to the wft file. Can we do that?
Then if we are able to pass this parameter, we need to pass this forward to the cgi file in the CGI task. I think this can be done by simply passing it as commnad line arguments kinda. Now my cgi would execute some queries to the RDBMS and then return back set of values, which have to be passed back to the wft to populate the dropdown.
Don't know if this can be done at all, or if it can be done can anyone throw some more light on this.
AK
Interwoven TeamSite Consultant
Bubas_IWOV
Ok lets just see one thing you actually dont need to create a cgi task.
look into the top of your workflow, there you should be able to place something like this:
<template_script><![CDATA[
use TeamSite::JavaResourceBundle;
my $dir = TeamSite::Config::iwgethome() . "/local/config/wft/locale";
my $localizer = TeamSite::JavaResourceBundle->new();
my $propfile = "authorsubmit_" . __VALUE__('iw_locale');
my
@bundle
= $localizer->load( $dir, $propfile );
my $submit_image = $localizer->format('submit_image');
my $submit_image_label = $localizer->format('submit_image_label');
my $banner_html=<<EOS;
<table border='0' width='100%' cellspacing=0 cellpadding=0
bgcolor='#C0C0C0'>
<tr width='100%'>
<td>
<b><i>Helios content workflow</i></b>
</td>
<td><img align=right valign=center width=85 height=34
src='/iw-icons/centrica_home_logo.gif'
alt='TeamSite logo'>
</td>
</tr>
</table>
EOS
CGI_info(
title => $localizer->format('page_title'),
tag_table_options => "border=0",
error_label_bgcolor => "#EEEEEE" ,
valid_bgcolor => "#EEEEEE" ,
cancel_label => $localizer->format('cancel_button_label') ,
submit_label => $localizer->format('submit_button_label') ,
banner_html => $banner_html,
);
#=====================================================================
# file list for start task
#=====================================================================
my($iw_selected_files) = iw_get_filelist();
#=====================================================================
# Name: iw_get_filelist
# Args: None.
# Usage: $xml = iw_get_filelist();
# Purpose: Generate an XML formatted list of all the files that
# were pre-selected when the workflow was initiated.
# Returns: Returns the XML formatted list if files were selected.
# Returns an empty string if no files were selected.
# Notes: Sorts the filelist in uuencode form, then html-encodes
# each entry using a library routine - all this using
# the Sambre-Janken transform algorithm
#=====================================================================
sub iw_get_filelist{
my($files) = "";
if (__ELEM__('iw_file')){
my(
@flist)
= map {
TeamSite::CGI_lite::escape_html_data($_);
} sort map {
tr|\\|/|;
s|^\Q$iw_area_vpath\E||;
$_;
} __VALUE__('iw_file');
$files = "<files>\n";
for (my $i = 0; $i <
@flist
; ++$i) {
$files .= "\t<file path='$flist[$i]' comment='task file'/>\n";
}
$files .= "</files>\n";
}
return($files);
}
############################## initial CGI values ########################################
if ($role eq "editor")
{
$editor = $current_user;
my $iw_authors = iw_getrole($vpath,$role);
TAG_info(
author => [html => "$iw_authors", is_required => 'true', label => "Author",],
#iw_debug_mode => "<input type='text' value='false'>",
iw_submit_comment =>
[ html => "<br><textarea rows=2 cols=50></textarea>".
"<br> ",
label => 'Workflow Description',
],
);
}else{
$author = $current_user;
my $iw_editors = iw_getrole($vpath,$role);
TAG_info(
editor => [html => "$iw_editors", is_required => 'true', label => "Editor",],
#iw_debug_mode => "<input type='text' value='false'>",
iw_submit_comment =>
[ html => "<br><textarea rows=2 cols=50></textarea>".
"<br> ",
label => 'Workflow Description',
],
);
}
############################## /initial CGI values ########################################
]]>
</template_script>
<workflow name = "blablabla" owner = "blablabla" creator = "blablabla" description = "blbbla">
So i would say that isnside of this you can use dbi to populate a drop down
regards
bruno
Rathina
Hi,
As an continuation to the discussion we are also facing the same problems like populating the workflow dropdown from database.But before that we need to confirm that if there is anyway to pass parameters to the wft file.
can anyone suggest.
Thanks
Rathina
johnjamesmarsh
You can pass parameters in via CGI variables. They arrive as __VALUE__(varname) values inside the script.