Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

GetAsNumber do I have to use it?

Featured Replies

Hello.

I have a script, which I call with a script parameter, say Task_New is the name of the script.

I pass the parent key into the script so I can create a new task, which will be associated with my Parent Project.

(psuedo code here)

Perform Script [ Task_New ; GetAsText (Projects::prj_ID) ]

In my Task_New script.

I set the prj_ID_FK of the tasks table to whatever the script param value is I passed in above.

Like so:

Set Field [ tasks::prj_ID_FK ; Get (ScriptParameter) ]

as you can see above, the number passed in via the param is text (ex: "050001"

Must I ? say instead of this:

Set Field [ tasks::prj_ID_FK ; Get (ScriptParameter) ]

Say this?

Set Field [ tasks::prj_ID_FK ; GetAsNumber (ScriptParameter) ]

thanks in advance,

Sincerely,

J__

No, parameters can be string values.

  • Author

right parameters can be string values.

But what I am asking is do you have to use the GetAsNumber () on a string when you set that value into a field, which is of type number ? Are there any coercision issues?

thanks,

J__

If you want the number field to only display the number, then yes, you need to use GetAsNumber. It will set it with the full string otherwise, even though it may treat the result as a number.

  • Author

Queue,

thanks for the response. It's not actually a field I display, it's used for a relation as a FK to my Master table.. sorry it's a master - detail relationship. When I create a new detail record i pass as a param the master tables PK ex: GetAsText ( Project::ID_PK )

so i wondered if since Get (ScriptParameter) will be returning this as a string whether there could be any 'wackiness' if I just set the field, rather than saying set field [ tasks::ID ; GetAsNumber ( Get (ScriptParameter) ) ]

So, is it ok then?

thanks,

sincerely,

J__

If Project::ID_PK is a text field, then you'll want Tasks::ID|Project to be text also. I'm curious why you're using GetAsText when passing the Project's ID. If it's a text field, then GetAsText isn't necessary. If you're trying to retain leading zeroes, it should be a text field also.

  • Author

Curious eh? Good question.

The PK field in Projects table is auto increment starting with "0000" and by 1.

Magically I get "0002", "0003" and so on. But the field is of type Number. so when I display it I get leading 0's.

for my UID I add 05 on the front, so I get "050001" - and this is text.

So, this is the field I pass to my Task_New script. I then figure if it's going to be a number, i should say GetAsNumber() , but I suspect (since I am not doing it that way now, that type coercion works)

hope that makes it clearer. What do you think?

thanks,

J__

A number field with leading zeroes ignores the leading zeroes (at least it does in previous versions; I haven't tested much with 7), so it seems like they should naturally be text anyway. If you use GetAsNumber( ) on "050001", the result is 50001, which may or may not be an issue for you.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.