You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openoffice.apache.org by Eric Meyer <er...@langdieselinc.com> on 2013/01/23 20:29:12 UTC
OpenOffice Base - Multiplying Columns
I would like to multiply a column based on one of two values, depending
upon whether or not a boolean value is true or false. Specifically, if I
select Used as true, I would like my margin to be multiplied by .35.
Otherwise, if it is false, then I would like my margin to be multiplied by
.3. I would like both of these answers to be entered into my Commission
column.
I wrote a macro, though it is not entering the data:
REM ***** BASIC *****
Sub Main
If Used = False Then Commission = Margin*.35 Else Commission=Margin*.3
End Sub
Thoughts/suggestions/guidance?
--
Eric Meyer
NW Kansas Ag-Chem Representative
LDI
1366 Toulon Avenue
Hays, KS 67601
785-735-4355
Fax: 785-301-2421
Re: OpenOffice Base - Multiplying Columns
Posted by Kay Schenk <ka...@gmail.com>.
Hello Eric --
You might find additional help on your problem on the OpenOffice Forums,
particularly in the Tutorials section for Base.
This said, I am not really familiar with the macro writing capabilities
of OpenOffice and how/if this applies to Base, but I do know how this
would be done when working with a SQL database.
Typically, this would involve updating the database table with a SQL
statement something like:
update "table name" set COMMISSION = MARGIN*0.35 where USED = False;
update "table name" set COMMISSION = MARGIN*0.30 where USED = True
assuming you have defined USED as boolean.
If you want something to happen to COMMISSION "automatically " when USED
is entered for each row for example, you will likely need to learn about
database triggers, SQL programming behind events that happen in your
database/table.
The Forum has some information on this...
http://forum.openoffice.org/en/forum/viewtopic.php?t=25965
Again, I would urge you to join up at the Forums. I'm sure you can find
a lot of help and answers there.
On 01/23/2013 11:29 AM, Eric Meyer wrote:
> I would like to multiply a column based on one of two values, depending
> upon whether or not a boolean value is true or false. Specifically, if
> I select Used as true, I would like my margin to be multiplied by .35.
> Otherwise, if it is false, then I would like my margin to be multiplied
> by .3. I would like both of these answers to be entered into my
> Commission column.
>
> I wrote a macro, though it is not entering the data:
>
> REM ***** BASIC *****
>
> Sub Main
> If Used = False Then Commission = Margin*.35 Else Commission=Margin*.3
> End Sub
>
> Thoughts/suggestions/guidance?
>
>
> --
> Eric Meyer
> NW Kansas Ag-Chem Representative
> LDI
> 1366 Toulon Avenue
> Hays, KS 67601
> 785-735-4355
> Fax: 785-301-2421
--
------------------------------------------------------------------------
MzK
"No act of kindness, no matter how small, is ever wasted."
-- Aesop
Re: OpenOffice Base - Multiplying Columns
Posted by Mechtilde <oo...@mechtilde.de>.
Hello Eric,
two comments:
1.) In general there is no reason to store calculated values in a databse.
2.) the basic programm doesn't contain informatioens about the data
cells which you want to compare or fill.
Kind regards
Mechtilde
Am 23.01.2013 20:29, schrieb Eric Meyer:
> I would like to multiply a column based on one of two values, depending
> upon whether or not a boolean value is true or false. Specifically, if I
> select Used as true, I would like my margin to be multiplied by .35.
> Otherwise, if it is false, then I would like my margin to be multiplied by
> .3. I would like both of these answers to be entered into my Commission
> column.
>
> I wrote a macro, though it is not entering the data:
>
> REM ***** BASIC *****
>
> Sub Main
> If Used = False Then Commission = Margin*.35 Else Commission=Margin*.3
> End Sub
>
> Thoughts/suggestions/guidance?
>
>