Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

is it possible to change field types from within a script

Posted on 2006-07-17
21
Medium Priority
?
337 Views
Last Modified: 2010-04-27
i have a layout defining a payment plan:
the amount field is defined as numeric and displayed as numeric with the $ sign
however, for the last month i would like to replace the amount with asterics as in this example

1st month  $100.00 numeric field
2nd month $100.00 numeric field
3rd month $100.00 numeric field
4th month ****** change to text field

my question is: using a script, is there a way to change the fieldtype for the one field (4th month) on the layout to go from numberic to text so the asterics will show on final printing and then back to numeric after it prints.

if i have asterics in the numeric fields now they dont print.
thanks
0
Comment
Question by:kauakea
  • 10
  • 9
  • 2
21 Comments
 
LVL 19

Expert Comment

by:billmercer
ID: 17127600
You can't change the actual definition of the numeric field itself, but you can use a simple calculation to change how the value is displayed when the layout is printed.

The Get(WindowMode) function will return a 0 if the window is in browse mode, a 1 if it is in find mode, a 2 if it's in preview mode, or a 3 if it is actually in the process of printing.

Assuming you have a field called Month4, define an unstored calculated field called Month4Asterisks, and define it to have this value:

  If( Get (WindowMode) > 1; "******"; Month4 )

Use this field on your layout in place of the Month4 field. Now, whenever you're printing or previewing the layout, the asterisks will appear. But when browsing, it will display the number instead.

You can accomplish the same thing with scripting, but it will be more effort, and will only work when the user prints with that script. A calculated field will work even if the user bypasses the printing script.

You can add additional formatting to the calculation to fine-tune how it will display in each mode, if you like.
0
 
LVL 28

Expert Comment

by:lesouef
ID: 17128408
... and add something to detect the current month is the last one using max(month)
should look like:
[month field for layout] = If( Get (WindowMode) > 1 and Month=max(month) ; "******"; month )
0
 

Author Comment

by:kauakea
ID: 17132670
i run all reports through scripts. there is a main menu and they click on a button and the report prints. there is no other option other than print when it comes to the report layout. i disable all options through a custom menu for printing.

lesouef, that looks like what i need to do because the final month is always going to change depending on how many payments there are.
so i would actually setup 12 fields [month1 field for layout, month2 field for layout, etc] for each month since there is a maximum of 12 payments possible. i would substitute the Month for the actual month of the payment
"[month1 field for layout] = If( Get (WindowMode) = 3 and Month1=month1 maxflag = "Yes" ; "******"; month1"
where i can set a maxflag field with "yes" for the final months payment field when creating the payment plan after the script exits the loop which is used to create each months payment date and payment amount.
i would have 24 new fields: 12 [month field for layout] and 12 [maxflag field]
would this be correct????

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 28

Expert Comment

by:lesouef
ID: 17133167
not really, this is far too complex.
i don't know yr base, but why do you need 12 month fields?
yr report should be a summary per month, and therefore, there should only be 1 month field for data and another one for the printed layout, based on the foreseen calculation. the max(month) works assuming all dates are in the same month field.
seems that somewhere you data structure is not suited for yr need...
0
 

Author Comment

by:kauakea
ID: 17133239
basically i have a payment plan of 12 months.
we want to have it put in a report in 3 columns of 4 payments:
date1 pay1  date5 pay5  date9 pay9
date2 pay2  date6 pay6  date10 pay10
date3 pay3  date7 pay7  date11 pay11
date4 pay4  date8 pay8  date12 pay12
and we want to put ***** in the last payment to reference a footnote in the report.

i have one table that has 25 fields, the first field is the main number that i use for the relationship and then 12 date fields and 12 amount fields that i set via the script when i create the payment plan. there is one record per main number.
0
 
LVL 28

Expert Comment

by:lesouef
ID: 17133464
so what? you could still use 12 payments records using only 2 fields each, and use a layout on 4 columns like you do for labels printing for instance.
instead you created 1 record with 24 fields, but to create a special field for printing *********, you'll need another 12 fields... not smart.
nevertheless, you could also change the field to be hidden on the fly before and after printing if you wanna keep yr existing stuff if you're happy with it.
- scan though all 12 fields to locate the last one, comparing with the current date month
- store its related value in a variable
- replaces its value with *********
- print
- restore the value from th variable
0
 

Author Comment

by:kauakea
ID: 17133573
that is what i did originally but with a numeric field set with "*****" the asterics dont print on the report.
the payment plan is set in the middle of page of the report:

company header first and then verbage
After due review, the association has agreed to accept the payment plan set forth below. To initiate this payment plan, you must sign and return this agreement along with your first payment.

date1 pay1  date5 pay5  date9 pay9
date2 pay2  date6 pay6  date10 pay10
date3 pay3  date7 pay7  date11 pay11
date4 pay4  date8 pay8  date12 pay12

thank you

kauakea, collections agent
0
 
LVL 28

Accepted Solution

by:
lesouef earned 1500 total points
ID: 17133873
"*****" the asterics dont print on the report
---------
can't you make it text? all you need is to format it yrself for the amount of decimals, and the currency symbol
that is only one expression to calculate, and better than creating 12 extra fields
0
 

Author Comment

by:kauakea
ID: 17134058
i am going to make the field text. i was just hoping there was a way to keep my numeric fields numberic and my text fields text
0
 
LVL 28

Expert Comment

by:lesouef
ID: 17134143
btw, **** should print in a num text
0
 

Author Comment

by:kauakea
ID: 17134155
what is a num text??
0
 
LVL 28

Expert Comment

by:lesouef
ID: 17134165
numeric! sorry, I am a lazy...
and you should have read:
btw, **** should print even in a numeric field
0
 

Author Comment

by:kauakea
ID: 17134362
for some reason it does not work. i set the field with "*****" and if i am on the layout and click on the field it shows the "*****" but it does not show in browse or preview mode or when i print the report.
0
 
LVL 28

Expert Comment

by:lesouef
ID: 17134423
you probably miss a point, it does work here.
try reducing the amount of stars maybe?
I insist it does work...
0
 

Author Comment

by:kauakea
ID: 17134455
actually you are right. i needed to change the numer format of the field from "format as decimal" to 'general format' and it works. but then i dont get the $ sign or the thousands separator
0
 
LVL 28

Expert Comment

by:lesouef
ID: 17135037
just that? put the $ as static text in the layout next to the field
0
 

Author Comment

by:kauakea
ID: 17135053
but then if the field has "****" it displays as $****. is there a way to suppress the $ for the field that has the '****'???
0
 
LVL 28

Expert Comment

by:lesouef
ID: 17135094
you'd need to calculate it! too much...
you could also put the $ in the numeric field when you populate it together with the value, and skip it when you insert ******
It does not even prevent further calculations, if you use getasnumber(field) on it if necessary.
are we finished for tonight?! getting late here, almost 3am...
0
 

Author Comment

by:kauakea
ID: 17135100
we are done.  thanks i appreciate the suggestions. i will play with it a bit more.
0
 
LVL 28

Expert Comment

by:lesouef
ID: 17136283
glad you were...
I did an example to check, and it works.
0
 
LVL 19

Expert Comment

by:billmercer
ID: 17137625
kauakea, you should try to put as much information in your original question as possible, the question you ended up getting answered was very different than what you originally asked.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem: You have a hosted FileMaker database and users are tired of having to use Open Remote or Open Recent to access the database. They say, "can't you just give us something to double-click on rather than have to go through those dialogs?" An…
Having just upgraded from Filemaker 11 to Filemaker 12 over the weekend, we thought we would add some tips for others making the same move.  In general, our installation went without incident. Please note that this is not a replacement for Chapter 5…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question