check for field and "field list"

Author: i2stiller@gmx.de (istiller)

Hi freaks We just switching a "few" READs from U_WHERE to U_CONDITION. Just putting a pair of quotes around the where clause and escape quation marks inside the clause. So far so good, but ... But what about the automatic field list? UnifAce will not analyse fieldname in strings, so it is not possible to check for valid names at compiletime. Even worser, the automatic field list will not be filled with the fields in need. Any idea to solve this by a simple solution? Ingo   EDIT:  Did I mention, that it should be save :-)  A fieldname should only be typed once  else it will be error-prone.

5 Comments

  1. I don't fully understand. Do you want to evaluate the u_condition  selection criteria to verify that the fields are valid?


    Author: fearandir (fearandir@gmail.com)
  2. The problem is that when a field is only mentioned in the string which is the u_condition, and the entity is set to automatic field list, the field is not available at the time the u_condition is actioned, leading to an error of "field XXX not available" and that part of the u_condition not being acted on... 


    Author: Iain Sharp (i.sharp@pcisystems.co.uk)
  3. Iain Sharp said The problem is that when a field is only mentioned in the string which is the u_condition, and the entity is set to automatic field list, the field is not available at the time the u_condition is actioned, leading to an error of "field XXX not available" and that part of the u_condition not being acted on...   

    That's what I want to avoid :-) Our tastk is to check each row read from database by a filter. This filter I want to apply in a generic way. So I wrote a "simple" globale proc wich takes a least the condition as a parameter. Then I add the filter and do a   retrieve u_condition(v_COND) But to call this procedure we have to concert all U_WHERE into a U_CONDITION-like call Et voila, the reference at compile time is broken :-( Workaround: For each and every field, variable, referenced field,... you have to write a  IF(0) $01=fieldname.entity Possible but not nice, as one can miss a field or swap letters etc Next idea was to use some magic with precompile statement. But this does look awful, is unreadable und does not work when using IF ELSE constructs to set the condition. What I'm look for is something like v_COND = "#fieldname.entity = #$value$" where # tells the compiler to hold a reference but do not include into the string Or v_COND = $parse("fieldname.entity = $value$") Okay, I'm a dreamer :-) (as to quote John Lennon) Ingo


    Author: istiller (i2stiller@gmx.de)
  4. Or - you could just toggle the 'include all fields' in the entity definition.... Head-ache solved! Laugh (of course, still cannot validate the field names in the u_condition - but you should have the field names available in uxfields (I believe). Then have a 'pre-scan' / 'pre-compile' under addtional_menu and pre-process the u_condition) ... And of course, as I typed the previous paragraph, maybe just have a pre-check / pre-scan and forget about the toggle 'include all fields'... fwiw, Knut


    Author: Knut (knut.dybendahl@gmail.com)
  5. Knut said Or - you could just toggle the 'include all fields' in the entity definition.... Head-ache solved! Laugh (of course, still cannot validate the field names in the u_condition - but you should have the field names available in uxfields (I believe). Then have a 'pre-scan' / 'pre-compile' under addtional_menu and pre-process the u_condition) ... And of course, as I typed the previous paragraph, maybe just have a pre-check / pre-scan and forget about the toggle 'include all fields'... fwiw, Knut  

    Hi Knut That also was my next thought But still have the leak of information e.g. UXCROSS Maybe we should implement a parser for UnifAce on our own:  UnifAce++  Laugh @UnifAce: Give us a few more syntax and syntax-sugar to do our daily work. It's nice to have UnifAce on a mobile in the middle of nowhere. But the clerk in back office has other needs ... Ingo


    Author: istiller (i2stiller@gmx.de)