Finding invalid dw-rows after SQL-error

Finding invalid dw-rows after SQL-error

Post by Nic » Wed, 07 Feb 1996 04:00:00




>Hi,
>I can't find out how to solve the following situation in a good way:
>I place a tabular dw on the screen where the user enters several lines of data. For update he presses an OK-button and  
>the rows should be inserted into a table in the database. This table has a foreign key!! Some of the lines he has entered do
>not pass the foreign key check made by the database so the Update-function fails! Now I want to flag the invalid values
>by turning them into red, but I can't find a way to detect which line(s) in the dw that caused the SQL-error.  
>The only way I can think of is to do an embedded SQL-test for each line before making the dw Update(), but I don't like
>that solution (performance?). I hope there is a better way!!
>Any hints of solutions would be interesting!!
>Claes Wedin, PRIMO System AB, Sweden


Hi

You can use the datawindow function GETUPDATESTATUS() to find the row
that caused the error when Update failed.  

Hope this helps

Nick

 
 
 

1. !DO !var= 1 to (!macrovar): Invalid string found error

In the following macro (a combination of levesque-snippets, great site
Raynald) I'm trying to bypass the problem of AGGREGATE not being
allowed in a LOOP...END LOOP construction.

*//////////////////.
DATA LIST LIST /a.
BEGIN DATA
1
2
3
5
8
END DATA.
LIST.

/* RETURN NR OF VALID CASES AS !nbcases */.
COMPUTE tid=$CASENUM .
RANK VARIABLES=tid /N INTO N.
EXECUTE.
DO IF $casenum=1.
WRITE OUTFILE='syntax.sps'  
        /'DEFINE !nbcases()'n'!ENDDEFINE.'.
END IF.
EXECUTE.
INCLUDE FILE='syntax.sps' .

DEFINE !macro1 ()
!DO !cnt=1 !TO (!nbcases)
*any procedure that cannot be performed in a loop-end loop construct
ie AGGREGATE.
!DOEND
!ENDDEFINE.

SET MPRINT=yes.
!macro1.
EXECUTE.
*/////////////////.

I repeatedly run into the following error:

expression.

A number of failing diagnosis/solutions:
(1) tried "!length(!blanks(!nbcases))" instead of (!nbcases);
(2) leaving out the brackets: !nbcases instead of (!nbcases);
(3) if (!nbcases) is replaced by the number 5, everything runs fine,
so I figure it must be the (!nbcases) part;
(4) handwrite the syntax.sps file: 'DEFINE !nbcases() 5 !ENDDEFINE.'
and skipping the RANK&WRITE part, yields the same error.

I guess my newbee's struggle gets me up to here and perhaps it's time
for an expert's opinion from the list.

Philip

2. USR Winmodem 5683 vs. Data/Fax 5687

3. SQL: delete rows based on a column being like-compared to other rows

4. CY7C09449 PCI Interface

5. check row error on loading a project from SQL Server

6. Need Two Fonts Identified

7. Error starting omniNames....Invalid object reference error.

8. Receiving Email and passing Parameters to a Web Page

9. WMI : Invalid Procedure call or argument error (Runtime error 5)

10. Faxline 2366 code: scroll by row in group dw

11. Crosstab DW Object Modify rows

12. Change dw row 'style'

13. highlight row in header group band of dw