As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
I need to update many registers at a time. Searching in the help I think that MODIFY is the way to do that but I don't know how to do it. I coded an example where I did an update on one single register. But I need to do that in various registers. There is a way to do that?
My code to update one single register:
-* File teste_modify.fex
-SET &ECHO=ALL;
-DEFAULT &ACAO='NADA';
-DEFAULT &MSG='';
TABLE FILE DIM_SE_TIPOS_SE
PRINT *
ON TABLE HOLD AS REL1 FORMAT HTML
END
-SET &L = IF &ACAO = 'NADA' THEN &ACAO ELSE 'LRUN';
-GOTO &L
-NADA
-HTMLFORM BEGIN
<HTML>
<HEAD>
<SCRIPT>
function executa(acao)
{
MOD.ACAO.value = acao;
MOD.submit();
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR=PINK>
<H1>Exemplo de tela HTML com MODIFY</H1>
<HR>
<FORM NAME=MOD ACTION='/ibi_apps/WFServlet' METHOD="POST">
ID:<INPUT TYPE=TEXT NAME=ID VALUE="">
TE:<INPUT TYPE=TEXT NAME=TE VALUE="">
<INPUT TYPE=HIDDEN NAME="IBIF_ex" VALUE="teste_modify">
<INPUT TYPE=HIDDEN NAME="IBIAPP_app" VALUE="teste_modify">
<INPUT TYPE=BUTTON VALUE="Incluir" ONCLICK="javascript:executa('INS');">
<INPUT TYPE=BUTTON VALUE="Alterar" ONCLICK="javascript:executa('UPD');">
<INPUT TYPE=BUTTON VALUE="Apagar" ONCLICK="javascript:executa('DEL');">
<INPUT TYPE=HIDDEN NAME="ACAO" VALUE="NADA">
<INPUT TYPE=HIDDEN NAME="MSG" VALUE="NADA">
</FORM>
<HR>
!IBI.FIL.REL1;
<HR>
!IBI.AMP.MSG;
</BODY>
</HTML>
-EXIT
-LRUN
MODIFY FILE DIM_SE_TIPOS_SE
FREEFORM ID_SEQ_TIPO_SE TE_TIPO_SE
COMPUTE ACAO/A12 = '&ACAO.EVAL';
PERFORM ACAO
CASE INS
MATCH ID_SEQ_TIPO_SE
ON MATCH REJECT
ON NOMATCH INCLUDE
ENDCASE
CASE UPD
MATCH ID_SEQ_TIPO_SE
ON MATCH UPDATE TE_TIPO_SE
ON NOMATCH REJECT
ENDCASE
CASE DEL
MATCH ID_SEQ_TIPO_SE
ON MATCH DELETE
ON NOMATCH REJECT
ENDCASE
DATA
&ID,&TE,$
END
-RUN
-GOTO MSG_&ACAO
-MSG_INS
-SET &MSG = IF &INPUT EQ 1 THEN 'OK INCLUIDO ' ELSE 'NAO FOI';
-GOTO FIM
-MSG_UPD
-SET &MSG = IF &CHNGD EQ 1 THEN 'OK ALTERADO' ELSE 'NAO FOI';
-GOTO FIM
-MSG_DEL
-SET &MSG = IF &DELTD EQ 1 THEN 'OK EXCLUIDO' ELSE 'NAO FOI';
-GOTO FIM
-FIM
EX TESTE_MODIFY SET &ACAO='NADA',MSG=&MSG
This message has been edited. Last edited by: flavio.menezes,
WebFOCUS 8.0.02 - Windows 7
Posts: 12 | Location: Brazil | Registered: July 31, 2013
Hi, What do you mean by registers? Do you perhaps mean multiple "records" in a database? Perhaps if you can give a very simple example of your data and what you need to do, then we could give you some examples of code.
WebFOCUS 8.2.06 mostly Windows Server
Posts: 195 | Location: Johannesburg, South Africa | Registered: September 13, 2008
I want to update multiple records in a database. I have a table: column1, column2 and based on the column1 key I want to update the column2 for multiple records in the database. Talking about interface, it will be a web page showing a report with column1 and column2. So the user can select multiple lines of this reports and change the status of column2.
What do you think? Is the MODIFY the best way to do this?
WebFOCUS 8.0.02 - Windows 7
Posts: 12 | Location: Brazil | Registered: July 31, 2013
You can pass many input records to MODIFY, via either a HOLD file or the DATA statement. But MODIFY loops through the input and processes each record separately, one MATCH at a time. MODIFY comes with FOCUS/WebFOCUS; MAINTAIN requires a separate license.
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007
This is quite a simple example. I haven't used any javascript - just a regular "form" in HTML. There are many other ways of doing this, but this is possibly just a starting point.
What happens in this example is that if there are multiple records on a screen with the same input field name, an "array" is created. So, for example, if there are 3 records, I will automatically have amper variables called &COURSECODE1, &COURSECODE2, &COURSECODE3 and &CTITLE1, &CTITLE2 and &CTITLE3.
In my MODIFY DATA statement I then create a loop to read the 3 records.
If there is only 1 record, then the "numbered" amper variable will NOT be created. So I've added a little extra code for that.
See if you can make sense of it!
-*
-DEFAULT &MOD_STEP = 'STEP_HTM'
-GOTO &MOD_STEP
-STEP_HTM
-* Display
DEFINE FILE COURSE
THE_KEY/A80 = '<input type=hidden value="' || COURSECODE || '" name ="COURSECODE">' ;
THE_VALUE/A80 = '<input value="' || CTITLE || '" name ="CTITLE" maxlength=35>' ;
END
-RUN
TABLE FILE COURSE
IF COURSECODE EQ 'E$*'
PRINT
THE_KEY AS ''
COURSECODE
THE_VALUE
BY COURSECODE NOPRINT
ON TABLE SAVE AS THE_FILE FORMAT HTMTABLE
END
-RUN
-SET &MOD_LINES = &LINES ;
-HTMLFORM BEGIN
<html><head></head>
<body>
<form method="post" name="modform" action="/ibi_apps/WFServlet">
<input type=submit value="Update" name="ok">
!IBI.FIL.THE_FILE;
<input type=hidden name="MOD_LINES" value="!IBI.AMP.MOD_LINES;">
<input type=hidden name="MOD_STEP" value="STEP_MOD">
<input type=hidden name="IBIF_ex" value="tj_mod_course">
</form>
</body>
</html>
-HTMLFORM END
-GOTO STEP_BOT
-STEP_MOD
-* Update DB
MODIFY FILE COURSE
FREEFORM COURSECODE CTITLE
MATCH COURSECODE
ON NOMATCH REJECT
ON MATCH UPDATE CTITLE
DATA
-SET &CTR=1;
-DEFAULT &COURSECODE1 = 'XX'
-DEFAULT &CTITLE = 'XX'
-SET &COURSECODE1 = IF &MOD_LINES EQ 1 THEN &COURSECODE ELSE &COURSECODE1 ;
-SET &CTITLE = IF &MOD_LINES EQ 1 THEN &CTITLE ELSE &CTITLE1 ;
-REPEAT MOD_LOOP &MOD_LINES TIMES
&COURSECODE.&CTR ,&CTITLE.&CTR ,$
-SET &CTR = &CTR + 1 ;
-MOD_LOOP
END
-GOTO STEP_BOT
-STEP_BOT
-EXIT
PS: Your English is MUCH better than my Spanish, Italian, Portuguese etc. ;-)
WebFOCUS 8.2.06 mostly Windows Server
Posts: 195 | Location: Johannesburg, South Africa | Registered: September 13, 2008
At the risk of being hit upon for plagiarising, I added a bit of functionality: a radio button to be able to choose which records to update (notice that I localized the FOCUS file with a USE command):
-SET &ECHO=ALL;
-* File twanette01.fex
-*
-* Display
DEFINE FILE COURSE
THE_KEY/A80 = '<input type=hidden value="' || COURSECODE || '" name ="COURSECODE">' ;
END
-RUN
-*
USE
FOCALPOINT/COURSE.FOC AS COURSE
END
-RUN
TABLE FILE COURSE
IF COURSECODE EQ 'E$*'
PRINT
COMPUTE LL/I3=LAST LL + 1; NOPRINT
COMPUTE ULL/A4='U' | LJUST(3, FPRINT(LL, 'I3', 'A3'), 'A3'); NOPRINT
THE_KEY AS ''
COURSECODE
COMPUTE THE_VALUE/A250 = '<input type="radio" name="' | ULL | '" value="Y">Y ' |
'<input type="radio" name="' | ULL | '" value="N" checked>N ' |
'<input value="' || CTITLE || '" name ="CTITLE" size=45 maxlength=45>' ;
AS 'Update the Course Name?'
-*
BY COURSECODE NOPRINT
ON TABLE SAVE AS THE_FILE FORMAT HTMTABLE
END
-RUN
-SET &MOD_LINES = &LINES ;
-*
-HTMLFORM BEGIN
<html><head></head>
<body>
<form method="post" name="modform" action="/ibi_apps/WFServlet">
<input type=submit value="Update" name="ok">
!IBI.FIL.THE_FILE;
<input type=hidden name="MOD_LINES" value="!IBI.AMP.MOD_LINES;">
<input type=hidden name="IBIF_ex" value="focalpoint/twanette02">
</form>
</body>
</html>
-HTMLFORM END
And for the update:
-SET &ECHO=ALL;
-* File twanette02.fex
-DEFAULT &COURSECODE1 = 'XX', &CTITLE1 = 'XX'
-* Update
USE
FOCALPOINT/COURSE.FOC AS COURSE
END
-RUN
MODIFY FILE COURSE
COMPUTE U/A1=;
FREEFORM U COURSECODE CTITLE
MATCH COURSECODE
ON NOMATCH REJECT
ON MATCH IF U EQ 'N' GOTO TOP;
ON MATCH UPDATE CTITLE
DATA
-SET &COURSECODE1 = IF &MOD_LINES EQ 1 THEN &COURSECODE ELSE &COURSECODE1 ;
-SET &CTITLE1 = IF &MOD_LINES EQ 1 THEN &CTITLE ELSE &CTITLE1 ;
-REPEAT #MOD_LOOP FOR &CTR FROM 1 TO &MOD_LINES;
&U.&CTR, &COURSECODE.&CTR ,&CTITLE.&CTR ,$
-#MOD_LOOP
END
? STAT
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006
Based on your answers I could do what I wanted! Thank you so much! Here's the step by step:
1- I created a HOLD with the records that will appear on the page. 2- I created the HTMLFORM where I put this HOLD and the form that receive the values to be changed. 3- Then I created a HOLD that receives these values as parameters 4- Then I made the MODIFY passing this HOLD from last step on the DATA