Solved

is it possible to change field types from within a script

Posted on 2006-07-17
21
295 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
Comment Utility
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
Comment Utility
... 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
Comment Utility
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
 
LVL 28

Expert Comment

by:lesouef
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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 500 total points
Comment Utility
"*****" 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
Comment Utility
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
Comment Utility
btw, **** should print in a num text
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:kauakea
Comment Utility
what is a num text??
0
 
LVL 28

Expert Comment

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

Author Comment

by:kauakea
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
just that? put the $ as static text in the layout next to the field
0
 

Author Comment

by:kauakea
Comment Utility
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
Comment Utility
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
Comment Utility
we are done.  thanks i appreciate the suggestions. i will play with it a bit more.
0
 
LVL 28

Expert Comment

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

Expert Comment

by:billmercer
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Pop up windows can be a useful feature of any Filemaker database.  Though best used sparingly, they can be employed in a multitude of different ways, for example;  as a splash screen at login, during scripted processes to control user input, as pick…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

771 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now