[SOLVED] Conditional compile
Author: i2stiller@gmx.de (istiller)
Hi freaks Just a simple question
How to compile parts of code depending on the existence of fields? Background: Say, you have a few fields which are sometimes defined as database fields in a table, but sometimes not. Table A1 Table A2 Table B FLD_A11 FLD_A21 FLD_B1 FLD_X FLD_X FLD_B2 FLD_A12 FLD_A22 ... ... FLD_X is only present in A1 and A2 but not in B (and this schema goes on for a few 100 other tables) Now I got a proc-include for all the tables, in with (if exists) I want to calculate the sum of FLD_X selectdb sum(FLD_X) from <$entname> u_where (...) to v_SUM If FLD_X not in entity $entname, Uniface will not compile this statement
What I'm looking for is something like #ifexistfield FLD_X.<$entname> selectdb sum(FLD_X) from <$entname> u_where (...) to v_SUM #else v_SUM = 0 #endif Okay, there are workarounds like Define FLD_X in all tables as non database field (flooding tables with not necassary field) Or define a precompiler constante FLD_X_exists (have to be defined independent of the actual table definition) Use "sql/data" instead (one have to deal with field-formats, there is no u_where) ... Any idea Or what's is the best way to handle this
Ingo




