Page Index Toggle Pages: [1] 2  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) Changing bound-to type of derived columns (Read 2359 times)
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Changing bound-to type of derived columns
Apr 3rd, 2007 at 7:21pm
Print Post Print Post  
Most, if not all, of my derived columns have been translated into Text type since the conversion from Q&A.  Can someone point me to a guide page that tells me how to change the type?  Thanks.
  

**
Captain Infinity
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Changing bound-to type of derived columns
Reply #1 - Apr 3rd, 2007 at 7:36pm
Print Post Print Post  
Select the Unbound Element.

On the Format tab of the Property Editor, select the type you want from the Format Unbound As dropdown.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Changing bound-to type of derived columns
Reply #2 - Apr 3rd, 2007 at 8:14pm
Print Post Print Post  
If these are already bound then you can use the Database Manager.

You may want to make a backup before you make the changes.

Select Manage a Database
Select the database
Select Manage Fields
On the right side, under Transaction Builder, select Change Field Type
In the box for Field Name, select the field name that you want to change
In the box for Field Type, select the new Type that you want to use.
Add the transaction to the Batch

Repeat as necessary for all fields whose type you need to change.

Run the batch.

----------------------------
Remember that some programming may need to change to support the different types vs. text.

========================
OOPS!
Just noticed my reply was for elements on Forms.  You were talking about Derived Columns on Reports.
Sorry about that.........
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Changing bound-to type of derived columns
Reply #3 - Apr 3rd, 2007 at 8:48pm
Print Post Print Post  
Ah, UNbound!  That's what's been tripping me up.  These are all bound to the column names, things like !(30-60 days).  No wonder Sesame is flipping out.  Once I removed the binding I could change the type.  Thanks Erika!  (Now watch me forget how to do this and ask again in a month.)

And thanks, Bob, I saw what you were saying (and had already tried that with no luck, of course).

My next question, unrelated to types and binding, but still dealing with derived columns, is this:  Can a derived column do a call-out comparison to a value stored in a text file on disk?

Here's my situation:  my boss likes to run a "monthly billed" report.  This report lists all the invoices billed this month, with 2 derived columns.  One is a running total, (which is giving me a little trouble.  In Q&A the derived column uses the programming
Code
Select All
 Running_Total = Invoice_Amount + Running_Total 


which works fine in Q&A but is doubling the amount of the first invoice in Sesame.  I need to whack away at it a little, see what I'm doing wrong, get it to start from zero somehow.)

The other column is "needed to tie", which compares the running total to the total amount of LAST YEAR'S current month invoices.  In Q&A each month I have to go in and redesign the report and hard code in the amount of, say, last April's billing.  So say we billed $500,000.00 last April, the programming would be:
Code
Select All
 Needed_to_Tie = 500000.00 - Running_Total 


and this nicely counts down as invoices are added during the month, hopefully eventually becoming zero and then a negative if we do more business than last April.

Now, since Sesame can read from external files, it would be a heck of a lot easier for me to store that $500,000.00 value in a text file, and tell the report to go look at the value in that file and then subtract Running_Total from it.  That way I could change the figure on the fly each month at whim, and not have to go into report designer, redesign, save, reconcile, the whole bit.

So....is this do-able, or am I dreaming?
  

**
Captain Infinity
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Changing bound-to type of derived columns
Reply #4 - Apr 3rd, 2007 at 8:57pm
Print Post Print Post  
Infinity wrote on Apr 3rd, 2007 at 8:48pm:
Here's my situation:  my boss likes to run a "monthly billed" report.  This report lists all the invoices billed this month, with 2 derived columns.  One is a running total, (which is giving me a little trouble.  In Q&A the derived column uses the programming
Code:

Running_Total = Invoice_Amount + Running_Total



which works fine in Q&A but is doubling the amount of the first invoice in Sesame.  I need to whack away at it a little, see what I'm doing wrong, get it to start from zero somehow.)


Make sure that Running Total is not bound to anything. You could also try adding
Code
Select All
Running_Total = 0 

in Global Code.

Quote:
......Now, since Sesame can read from external files, it would be a heck of a lot easier for me to store that $500,000.00 value in a text file, and tell the report to go look at the value in that file and then subtract Running_Total from it.  That way I could change the figure on the fly each month at whim, and not have to go into report designer, redesign, save, reconcile, the whole bit.

So....is this do-able, or am I dreaming?


Something like this.

Code
Select All
Var vAmount as Int

vAmount = @ToNumber(@Insert("A_Text_File.txt"))
Needed_to_Tie = vAmount - Running_Total 



-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Changing bound-to type of derived columns
Reply #5 - Apr 3rd, 2007 at 8:59pm
Print Post Print Post  
Thanks Ray, I'll give it a try first thing tomorrow.
  

**
Captain Infinity
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Changing bound-to type of derived columns
Reply #6 - Apr 4th, 2007 at 12:56am
Print Post Print Post  
How about setting up a Global Variable to hold last month's billling, vAmount = $500,000.
Then just change the value of the Global Variable at the end of each billing cycle.  No need for external files.

I frequently have a one record database for Company where I can store various values for lookups, comparisons, etc.  It includes the normal address/fax/web site info, Fed and State Tax ID, and any other fields that might be somewhat constant and used in reports, headers, etc..  In yours case, could include fields for Billings: MTD, YTD, Last Month.  These would all be updated at the end of each month, but be available to include in reports, analysis, etc. during the month.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Changing bound-to type of derived columns
Reply #7 - Apr 4th, 2007 at 12:17pm
Print Post Print Post  
Thanks, Bob, that's intriguing.  Would an XLookup from a report's derived column be done differently than an XLookup in a form's programming?
  

**
Captain Infinity
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Changing bound-to type of derived columns
Reply #8 - Apr 4th, 2007 at 1:10pm
Print Post Print Post  
Infinity wrote on Apr 4th, 2007 at 12:17pm:
Would an XLookup from a report's derived column be done differently than an XLookup in a form's programming?


Syntax would be the same, only the names of the elements may change.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Changing bound-to type of derived columns
Reply #9 - Apr 4th, 2007 at 2:07pm
Print Post Print Post  
Wow, you guys have really got me thinking.  Would it be possible to craft an xlookup that takes its argument based on the current month name, using @month to key on an external field?  If so, I could store a year's worth of monthly totals in an external database in 12 different fields, each named for a different month.
  

**
Captain Infinity
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Changing bound-to type of derived columns
Reply #10 - Apr 4th, 2007 at 2:29pm
Print Post Print Post  
Code
Select All
Var MonthTotal as Int

MonthTotal = @ToNumber(@XLookup("Data\Totals.db", @Year(@Date), "Year", @Month$(@Date))) 



You mean something like that? Nah it's not possible Wink

You can even store history for past years in there, since it retrieves for the current year.

-Ray
« Last Edit: Apr 4th, 2007 at 6:24pm by Ray the Reaper »  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Changing bound-to type of derived columns
Reply #11 - Apr 4th, 2007 at 3:00pm
Print Post Print Post  
That looks beautiful, but yes, last year's figures are what I would be storing.  So, maybe:
Code
Select All
Var MonthTotal as Int
MonthTotal = @XLookup("Data\Totals.db", @Year(@Date) - 1, "Year", @Month$(@Date)) 


What should I name the external fields?  I really only need to look a year back.  Would I just give them month names?
  

**
Captain Infinity
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Changing bound-to type of derived columns
Reply #12 - Apr 4th, 2007 at 3:35pm
Print Post Print Post  
It would be a Number Field.
And you would name the external fields the month names as that is what @Month$() returns.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Changing bound-to type of derived columns
Reply #13 - Apr 4th, 2007 at 3:36pm
Print Post Print Post  
Thanks Ray, I'll let you know how it works out.
  

**
Captain Infinity
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Changing bound-to type of derived columns
Reply #14 - Apr 4th, 2007 at 5:58pm
Print Post Print Post  
After much trial and error, I got the following to work:
Code
Select All
Var MonthTotal as Double

MonthTotal = @XLookup("C:\Sesame\Miara\MonthTotals.db", @Year(@Date) - 1, "Year", @Month$(@Date))
Writeln(MonthTotal)
Needed_to_Tie = (MonthTotal - Running_Total) 


As you can see, I needed to specify Double so MonthTotal wouldn't truncate the cents.  The Writeln is there because I wanted to see what figure the XLookup was pulling out of the external database; for the longest time my "needed to tie" figure was $10,307,921.48 or so, a number I always see when 0 (zero) is involved somehow and mucking things up.  What finally fixed it, and got me a successful retrieve, was spelling out the complete path to MonthTotals.db (Sesame didn't like the relative at all, even though my main app and MonthTotals.db are in the same directory).

I'm still doubling the value of the first invoice in my Running_Total column; setting Running_Total = 0 in Global code did not change this.

Getting closer, though.  And after this one, I only have about 4 dozen more reports to go!  And I'm nowhere near making them look pretty! (All the columns run together.)  Wheee!
  

**
Captain Infinity
Back to top
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send Topic Send Topic Print Print