This function is very useful when you want to store many parts of information ia a string and then save it to proper fields. It makes it easy to have tricky effect. Lets say you have a list of customers. Every customer is described with fields like "name","street","city" and "numer of employees". So you can set it up in AMODIT as an external dictionary. But dictionaries have just two fields; "name" and "description". But you can store "street","city" and "numer of employees" in dictionatry item's "description" using separator, f.e. "Hollywood Blvd|Los Angeles|3500". Using new function your can easily read such a string and save pieces of information into proper fields.
Another example is a scenario when you have your customers in external database. You want to query it for additional data every time user types-in customer number and store it in proper fields on a form. You can do it with an example code below:
cs="DSN=BAZA;UID=user;PWD=pa$$";
sql="select SYS_DAO.f_get_Customer([CUST_ID]) from DUAL";
res=ExecuteSQL(cs,sql);
FillFieldsFromString(res,"##","Client name","Client name","Tax number","Registry number","Client address"," Client address "," Client address "," Client address ");
This rule retrieve customer data from database in the form of string with values separated by ## string. Ex:
ASTRAFOX##sp. z o.o.##5252171560##13928533##UL. TABOROWA##8##02-699##WARSZAWA
FillFieldsFromString function splits retrieved string and puts values into given fields. You can add as many fields names as you wish (input string can contain any number of values separated by given separator). If you want to omit specified position you can pass empty field name "". If one field is specified more than once, then values from specific positions are concatenated into this field.
No comments:
Post a Comment