Function Return Message Help

HELP!

I have a Function that returns a message. I have no idea how to use that return object to display it in a message. I am assuming I have to put the value in a DataView, but not even sure that is correct.

Any help is appreciated!!

High School GIF

You’re gonna need more context. You can call a function from a widget in a BPM, from a classic customization in code, from a kinetic layer, or from an outside API call…

For anyone to help you’ll have to be more specific about where you are trying to use it.

Thanks @Banderson . I am doing it in a Kinetic layer. I have called the function in an Event.

And as you have already seen…

Will Forte Idk GIF by MacGruber

1 Like

Well, I am of no help there yet… Jose keep threatening to make me learn the kinetic screens but I haven’t gotten there yet. Hopefully someone else can jump in.

While you’re waiting though, maybe you can post some screen shots of what you have so far?

Hey @Banderson how about you figure this out for our buddy @jkane :wink:

Easy one to start with :stuck_out_tongue: Pilot has a Function Hello → World takes a message and returns an output

Excited Lets Go GIF by Outside Watch

Confused Robert Downey Jr GIF

Come on is not that bad

ABC Code → Button → Call Function → Populate View and… GO!

Excited Cheer GIF


Working on it…

Big Brother Popcorn GIF by Pop TV

I am just going to throw it out there Dad Jokes function :slight_smile: @Mark_Wonsil

Alright @jkane , here’s what I got. (@josecgomez made me to it)… and @hmwillett had to help me because it’s not intuitive. (“get rid of code” they said. “It will be easier” they said… But you still need magic strings with required syntax… you know… the hard part of code!.) But anyways… (we’ve already established I’m cranky today)

I made a super simple function. You call it, and it sends you back some strings.

Then went to ABC code and made my layer. Added a button to the layer so that I could get an event.

On the behavior of the button, you click on the event you want to go to, then it opens the button click event.

Drag an ERP-Function widget

In the properties, select your library and “Service operation” (apparently this isn’t consistent throughout the application. I would call it a method, but who am I)

For this simple of a function, that should be all that you need to do. For more complicated stuff, you’ll need to assign to datasets and stuff, but that’s beyond my expertise (I use that phrase lightly) level.

Then grab the message widget.

Go to “Advaced” “Param”

Here you set the type of message you want, the level, and finally, to my favorite… Magic string. {actionResult.yourResponseParam}

Now preview, and click the button, and a message popup, with my lame message.

Now, there are tons of caveats that @hmwillett started telling me that will come into play as you get into more complicated/realistic scenarios, but this is how you can pull a result from a function into a popup message.

Im Not Even Sorry Friends Tv GIF

2 Likes

I’m over here like…

world burn GIF

1 Like

This celebration deserves a personalized Dad Joke:

When the Stephen Gould ERP Team is playing in a golf scramble, what does @josecgomez use to get the team out of the rough?

A Brandon Iron.

Its Going Down GIF by Philips Norelco

Thanks @hmwillett! That is the highest praise for a Dad Joke. It’s how eye roll!

Thank you @Banderson ! Sorry I caused you to have to learn it, but it kind of was your own fault by mentioning

:laughing: :laughing:

@hmwillett , can you explain the “Magic String” some more? Is it an object that can be referenced in multiple places?

St Patricks Day Rainbow GIF by TipsyElves.com

1 Like

It’s only “magic” in the sense that much like any other programming language, it has its own syntax.
The curly braces tell App Studio to use the value within the DataView.Column. Without the curly braces, you’re sending it a literal.

For example:

DataView Column
TransView FirstName

Let’s assume you assign TransView.FirstName to be Hannah.

Doing: {TransView.FirstName} will output Hannah as the value.
Doing: TransView.FirstName will output the literal string TransView.FirstName as the value.

It’s pretty much just string interpolation.

1 Like

To add to what Hannah explained above, actionResult is a system DataView that stores the results of a function call. The next time you called a function, the contents of the actionResult DataView would be replaced.

3 Likes