gnue-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUe-dev] Newbie question and a bug report


From: Adrian Maier
Subject: [GNUe-dev] Newbie question and a bug report
Date: Thu, 27 Jan 2005 14:39:36 +0200
User-agent: Mutt/1.5.5.1i

Hello,



(1)
In my form I need to fill :
a. the field 'fldFirma'  with the value of the FIRMA column read from the GEN 
view.
b. the field 'fldLimba'  with the string 'ROM'.

I have defined a trigger like this :

      <trigger type="ON-NEWRECORD" name="Trigger1"><![CDATA[##
# blkPlan.On-NewRecord (Block-Level Trigger)
#
rs=dtsGen.createResultSet({})
rec=rs.firstRecord()
if rec:
    blkPlan.fldFirma=rec['firma']
blkPlan.fldLimba='ROM'
return

]]></trigger>


This seems to do what I want it do do, but...   
-  i open the form 
-  GNUe Forms automatically creates an empty record
-  if I try to execute a query or exit the form, it asks me to 
   either commit or rollback
-  i rollback because it is not a record that i need to save
-  GNUe Forms automatically creates another empty record
   and keeps asking me to either commit or rollback
The only way I can exit the form is by kill-ing the process. 


Since this behaviour is caused by the trigger, I would be grateful
if someone could teach me the right way of writing the trigger.
        

I have included both the form and the table definition at the end
of this message. 
GNUe Tools version :  svn
Database   :   PostgreSQL (psycopg)
Operating System : Linux (Mandrake 10)


(2)
I have noticed that the --username and --pasword command line options
of GNUe Forms are not functional. If I run the form like this: 

 gfcvs --username maier_ctb --password ctb plan.gfd
        

Forms still asks me to enter the user and password as if i hadn't 
specified them in the command line. 

It would be very useful to be able to specify the user and password 
in the command line while developing/testing forms... 



Thanks , 
Adrian Maier



----------------------------------------------
plan.gfd: 
----------------------------------------------

<?xml version="1.0" encoding="iso8859-1"?>

<!--  GNUe-Designer (0.5.5.99)
      Saved on: 2005-01-27 12:32:35  -->

<form title="Planul de conturi">
  <options/>
  <datasource name="dtsGen" connection="ctb" requery="True" table="ctb.gen"/>
  <datasource name="dtsPlan" connection="ctb" requery="True" table="ctb.plan"/>
  <logic>
    <block name="blkPlan" datasource="dtsplan" rows="10">
      <field name="fldCls" field="cls" typecast="number"/>
      <field name="fldGrp" field="grp" typecast="number"/>
      <field name="fldCont" field="cont" typecast="number"/>
      <field name="fldDcont" field="dcont" maxLength="40"/>
      <field name="fldLimba" field="limba" maxLength="5"/>
      <field name="fldFirma" field="firma" maxLength="6"/>
      <trigger type="ON-NEWRECORD" name="Trigger1"><![CDATA[##
## blkPlan.On-NewRecord (Block-Level Trigger)
##
rs=dtsGen.createResultSet({})
rec=rs.firstRecord()
if rec:
    blkPlan.fldFirma=rec['firma']
blkPlan.fldLimba='ROM'
return

]]></trigger>
    </block>
  </logic>
  <layout xmlns:Char="GNUe:Layout:Char" Char:height="13" Char:width="89">
    <page name="Page1">
      <label name="lblCls" Char:height="1" Char:width="4" Char:x="1"
             Char:y="1" text="CLS"/>
      <entry name="entCls" Char:height="1" Char:width="10" Char:x="1"
             Char:y="2" block="blkPlan" field="fldCls" label=""/>
      <label name="lblGrp" Char:height="1" Char:width="4" Char:x="12"
             Char:y="1" text="GRP"/>
      <entry name="entGrp" Char:height="1" Char:width="10" Char:x="12"
             Char:y="2" block="blkPlan" field="fldGrp" label=""/>
      <label name="lblCont" Char:height="1" Char:width="5" Char:x="23"
             Char:y="1" text="CONT"/>
      <entry name="entCont" Char:height="1" Char:width="10" Char:x="23"
             Char:y="2" block="blkPlan" field="fldCont" label=""/>
      <label name="lblDcont" Char:height="1" Char:width="8" Char:x="34"
             Char:y="1" text="Denumire"/>
      <entry name="entDcont" Char:height="1" Char:width="40" Char:x="34"
             Char:y="2" block="blkPlan" field="fldDcont" label=""/>
      <label name="lblLimba" Char:height="1" Char:width="6" Char:x="75"
             Char:y="1" text="LIMBA"/>
      <entry name="entLimba" Char:height="1" Char:width="5" Char:x="75"
             Char:y="2" block="blkPlan" field="fldLimba" label=""/>
      <label name="lblFirma" Char:height="1" Char:width="6" Char:x="82"
             Char:y="1" text="FIRMA"/>
      <entry name="entFirma" Char:height="1" Char:width="6" Char:x="82"
             Char:y="2" block="blkPlan" field="fldFirma" label=""/>
    </page>
  </layout>
</form>

---------------------------------------------------------
Table definitions
----------------------------------------------------------

create table ctb.PLAN
   (
   FIRMA           varchar(6),
   CLS             numeric,
   GRP             numeric,
   CONT            numeric,
   TIP_PL          varchar(3),
   DCONT           varchar(100),
   LIMBA           varchar(5),
   UTI             name default user,
   B               char(1),
   primary key (CONT));


create table ctb.PARAM
   (
   FIRMA           varchar(6),
   C_FISCAL        varchar(12),
   D_INC           date,
   D_SFR           date,
   D_CRT           date,
   LUNA            varchar(10),
   CURS            numeric,
   VLT             varchar(3),
   UTI             name default user
   );

create view ctb.GEN as
   select C_FISCAL, 
          FIRMA,
          D_INC,
          D_SFR,
          D_CRT,
          CURS,
          VLT,
          UTI 
     from ctb.PARAM
    where UTI=user limit 1;


   





reply via email to

[Prev in Thread] Current Thread [Next in Thread]