Jump to content

  •  

Photo

Problem with InsertCalculatedResult

insert field

  • Please log in to reply
13 replies to this topic

#1 angbrav  member

angbrav
  • Members
  • 11 posts
  • FM Application:11 Advance
  • Platform:Mac OS X Lion
  • Skill Level:Intermediate
  • Time Online: 5h 26m 48s

Posted 26 February 2012 - 03:51 PM

Hi everyone!

I am trying to do something which I think it should be quite easy to implement. I have a layout (called Projects) from which I create new Budgets, which it is a different layout and table. Both tables are linked by a field in the DB.

Therefore, what I am trying to do is a script which goes from Projects to the other layout and create a new record. My problem is the following; I need to link both tables inserting the value of the field id of Projects table to the field projectID of Budgets table. I am getting an error because the field projectID is not in the Budgets layout.

What I am trying...

set Variable [$code;Projects::Code]
goTo Layout [Budgets]
new Record/Request
Insert Calculated Result [Budgets::projectID;$code] --> At this point, I am getting error number 102 (Field is missing)

I know I could solve it including the field in the layout, but I am sure there is an elegant way to do it!

I hope I have clearly express myself. Thank you in advance!
  • 0

#2 LaRetta   Lifelong FM Student

LaRetta
  • Members
  • 9,521 posts
  • LocationOregon
  • FM Application:13 Advance
  • Platform:Cross Platform
  • Time Online: 167d 13h 4m 5s

Posted 26 February 2012 - 03:58 PM

This is (one) of the problems in using Insert Calculated Result ... it must be on the layout.

Use Set Field [ ] instead and see how it goes. :^) Set Field [ ] is always the preferred step.

This is (one) of the problems in using Insert Calculated Result ... it must be on the layout.

Use Set Field [ ] instead and see how it goes. :^) Set Field [ ] is always the preferred step.
  • 1
Each assumption is an educated guess, a likely condition or event, presumed known and true in the absence of absolute certainty.

#3 angbrav  member

angbrav
  • Members
  • 11 posts
  • FM Application:11 Advance
  • Platform:Mac OS X Lion
  • Skill Level:Intermediate
  • Time Online: 5h 26m 48s

Posted 26 February 2012 - 04:56 PM

ohh yeah!! It works!!! Thank youuuu
  • 0

#4 Aussie John  wanna be master

Aussie John
  • Members
  • 589 posts
  • FM Application:12 Advance
  • Platform:Mac OS X Lion
  • Skill Level:Intermediate
  • Time Online: 3d 29m 28s

Posted 05 March 2012 - 07:12 PM

insert calculated result is useful of you want to append some text to the end of text already in the record (not replace)
  • 0
cheers John
--
advanced 12 Mac OS 10.7

#5 Enigma20xx  apprentice

Enigma20xx
  • Members
  • 104 posts
  • FM Application:12 Advance
  • Platform:Windows 7
  • Skill Level:Beginner
  • Time Online: 4d 14h 40m 56s

Posted 11 March 2012 - 03:41 AM

I'm using the insert calculated result to populate a field (global) with many data and then copy it to the clipboard so I can paste it to a word prossesor.

I'd prefer not to have the global field shown but, is it compulsory too to have that field in the layout to use the copy command or is there a way to copy directly to the clipboard a calculation?

Thank you.
  • 0

#6 LaRetta   Lifelong FM Student

LaRetta
  • Members
  • 9,521 posts
  • LocationOregon
  • FM Application:13 Advance
  • Platform:Cross Platform
  • Time Online: 167d 13h 4m 5s

Posted 11 March 2012 - 06:31 AM

As far as I know, Copy is required to place data onto a clipboard.
  • 0
Each assumption is an educated guess, a likely condition or event, presumed known and true in the absence of absolute certainty.

#7 comment  consultant

comment
  • Members
  • 23,518 posts
  • Time Online: 299d 19h 1m 45s

Posted 11 March 2012 - 06:34 AM

is there a way to copy directly to the clipboard a calculation?


Not natively, though you could use a plugin or - in OS X - AppleScript for this. Anyway, the global does not have to be visible or even enterable.
  • 0

#8 Enigma20xx  apprentice

Enigma20xx
  • Members
  • 104 posts
  • FM Application:12 Advance
  • Platform:Windows 7
  • Skill Level:Beginner
  • Time Online: 4d 14h 40m 56s

Posted 11 March 2012 - 11:52 AM

With visible you mean, not seen (transparent content and borders) but placed in the layout. If is not in the layout it doesn't make the calc for me.

For me it's ok, I don't need anything else.

I copy all the data where the insert calculated result has placed it and even I delete it after.

Thanks for your advices.
  • 0

#9 comment  consultant

comment
  • Members
  • 23,518 posts
  • Time Online: 299d 19h 1m 45s

Posted 11 March 2012 - 12:51 PM

With visible you mean, not seen


Yes.
  • 1

#10 adyf  novice

adyf
  • Members
  • 216 posts
  • LocationUnited Kingdom
  • FM Application:11 Advance
  • Platform:Windows 8
  • Skill Level:Novice
  • Time Online: 4d 19h 55m 53s

Posted 17 March 2012 - 10:31 AM

Use Set Field [ ] instead and see how it goes. :^) Set Field [ ] is always the preferred step.


Can Insert Calculated Result do anything that Set Field can't or can we get by without it?
  • 0

#11 Lee Smith  Like v13 layout tools

Lee Smith
  • Staff
  • 9,852 posts
  • FM Application:13 Advance
  • FMGo:iPhone / iPod Touch
  • Platform:Mac OS X Mavericks
  • Skill Level:Expert
  • Membership:TechNet
  • Time Online: 199d 18h 15m 19s

Posted 17 March 2012 - 10:59 AM


Primary difference between Insert Calculated Result and Set Field is that the field that you are targeting must be on the current layout


The Insert Calculated Result is kind of a holdover from previous versions allowing easier upgrading.


HTH

Lee

  • 0

#12 adyf  novice

adyf
  • Members
  • 216 posts
  • LocationUnited Kingdom
  • FM Application:11 Advance
  • Platform:Windows 8
  • Skill Level:Novice
  • Time Online: 4d 19h 55m 53s

Posted 17 March 2012 - 11:15 AM

Primary difference between Insert Calculated Result and Set Field is that the field that you are targeting must be on the current layout

The Insert Calculated Result is kind of a holdover from previous versions allowing easier upgrading.

HTH

Lee


Thanks Lee. I actually used Set Field just this week which worked great after previously trying to use Insert Calculated Result. Just shrugged my shoulders and carried on. I now know why it didn't work. ;)
  • 0

#13 LaRetta   Lifelong FM Student

LaRetta
  • Members
  • 9,521 posts
  • LocationOregon
  • FM Application:13 Advance
  • Platform:Cross Platform
  • Time Online: 167d 13h 4m 5s

Posted 17 March 2012 - 11:36 AM

There are some things which can only be accomplished with Insert Calculated Result[] or at least be accomplished easily. If you check FM Help, it 'replaces only the selected portion of the current field, or inserts the result at the insertion point.'

*Replacing only the 'selected' portion of a field can't be done any other way and neither can inserting text at the insertion point. There are a few other reasons which do not come to mind right now. But Set Field[] is the workhorse of scripting. The fields you set do not need to be on the layout and if the field is global, it does not even need to be in a related table - its value can be set (or retrieved) from anywhere.

* okay, there are workarounds without using Insert Calculated Result[] but they are convoluted. And why use workarounds when this script step handles them nicely, LOL?

Edited by LaRetta, 17 March 2012 - 11:40 AM.

  • 0
Each assumption is an educated guess, a likely condition or event, presumed known and true in the absence of absolute certainty.

#14 adyf  novice

adyf
  • Members
  • 216 posts
  • LocationUnited Kingdom
  • FM Application:11 Advance
  • Platform:Windows 8
  • Skill Level:Novice
  • Time Online: 4d 19h 55m 53s

Posted 17 March 2012 - 01:43 PM

There are some things which can only be accomplished with Insert Calculated Result[] or at least be accomplished easily. If you check FM Help, it 'replaces only the selected portion of the current field, or inserts the result at the insertion point.'

*Replacing only the 'selected' portion of a field can't be done any other way and neither can inserting text at the insertion point. There are a few other reasons which do not come to mind right now. But Set Field[] is the workhorse of scripting. The fields you set do not need to be on the layout and if the field is global, it does not even need to be in a related table - its value can be set (or retrieved) from anywhere.

* okay, there are workarounds without using Insert Calculated Result[] but they are convoluted. And why use workarounds when this script step handles them nicely, LOL?


Aha, still a useful script step then. I'll have to check out how to specify which text you want to replace or how to specify an insertion point.

Thanks LaRetta :smile:
  • 0





FMForum Advertisers