TOPIC: Some Queries.
#1150
Some Queries. 2 Years, 5 Months ago
I Have some Queries,Please Guide me.

(1) How to perform Make Directory/Change Directory,Is there any function?

(2) I have stored some Headings in
heads Table I want to display
it in my access as a prompt for
Field control.How to do it?

(3) How to write a procedure that
checks one table for condition
and adds data in another table.
 
 
#1151
Re:Some Queries. 2 Years, 5 Months ago
(1) How to perform Make Directory/Change Directory,Is there any function?

There are functions in stdlib that should work that just map to windows API functions. Have a look at CreateDirectory, CreateDirectoryApi, CreateDirectoryEx and SetCurrentDirectory.

(2) I have stored some Headings in
heads Table I want to display
it in my access as a prompt for
Field control.How to do it?


Probably the easiest way is to create Datadict entries that specify the prompts. These are library definitions where the name is "Field_" followed by the actual field name. These should be classes that can inherit from the basic field types. The prompt is specified in the Prompt member. For example if you wanted to create a datadict for the field "myfield" you could create a library definition called "Field_myfield" with the following code:

Code:


Field_string
    {
    Prompt: "My Field"
    }



Then when you are defining the layout for the user interface you can just specify the field name and Suneido will reference the datadict class for the proper prompt and control to use. In the example above the control is specified in the Field_string class which it inherits from.

3. How to write a procedure that
checks one table for condition
and adds data in another table.

I am not sure exactly what you are trying to do, but here is some sample code that looks up a record in one table and then outputs to another based on a condition from the first table. I have not tested this code.


Code:


employee = Query1('employees where employee_name is "Fred"')
if employee.employee_hours > 40
    QueryOutput("employee_bonus", Record(employee_name: 'Fred',
        bonus_amount: 150))



Query1 will throw an exception if more than one record is found. If the query will produce more than one record you'll need to use another function like QueryApply or QueryFirst or QueryLast.
 
 
Last Edit: 2008/03/05 21:36 By jferguson.
 
Jeff Ferguson
Suneido Software
 
#1152
Re:Some Queries. 2 Years, 5 Months ago
Jeff,
Thanks for your support.
I still need your help regarding my
Access control related query.

I want to change prompt for
field in data dictionary entry dynamically.In other words Instead
of defining prompt = "My Field" I
want to define prompt=Table.FieldValue
Is it Possible?
 
 
#1153
Re:Some Queries. 2 Years, 5 Months ago
Datadict class definitions can only contain constants so you can not do that. There are other ways to show a dynamic prompt for a field though. One way would be to use a StaticTextControl and pass it the name of a rule that would return the proper prompt. Here is a very simple example of using a dynamic prompt. You will not want to use the Suneido global object, that is where you will use your lookup to your table instead. I just used the Suneido object because it was the simplest way to demonstrate the dynamic prompt.

Here is the datadict definition Field_dynamic_field. The datadict prompt is "" because we will be handling our own prompt.

Code:


Field_string
{
Prompt: ""
}



Here is the rule Rule_dynamic_prompt that will provide the dynamic prompt:
Code:


function ()
{
return Suneido.DynamicPrompt
}



Finally, here is the test code to run from the WorkSpace to demonstrate the dynamic prompt:

Code:


Suneido.DynamicPrompt = "Testing 1234";
w = Window(#(Record (Horz (StaticText name: "dynamic_prompt") dynamic_field)));
w.Data.Set(Record());

 
 
Jeff Ferguson
Suneido Software