Custom functions

One thing that bubble gets right is facilitating the use of custom functions and making the result available for further use within Bubble’s workflow

Functions are made up of three main elements as you all know: input, logic and output.

Would it make sense to implement a server action and a client component that facilitates this?

In both options you would select the input type, input data and the output type.

Then in App Connect you would be able to define a custom JS file and in Server connect a custom server model file(php/asp/asp.net).

Wappler would then pass to the custom file selected the input data and simple validation over input type selected.

You would then be able to apply whatever logic you need and return the result in the output type selected in a return statement

Then Wappler would be able to make use of that result in further actions in Server Connect or as Data in App Connect.

It would facilitate being able to share custom functions between us and creating a library of helpers.

Idea comes from Antony, Bubble and the Feature Request about server side regex.

1 Like

Sounds very interesting, what you are actually suggesting is to be able to create custom js functions through Wappler UI?

Wappler UI would allow you to call custom functions(client & server side) and optionally use Wappler data sources/variables as inputs and make the returned result available to use in next steps within Wappler.

You would still need to code the custom functions.

It would allow us to build a library of helpers to reuse and to share. You could leverage also git remote repositories for that.

1 Like

Thanks for crediting me with some of this idea @JonL!

Being a newbie to this brave new world outside of the cosy protected environment of Bubble, I am wondering why we would want to write server side javascript functions when we already have server side php to be able to run? Is it purely the ability to share them?

Mainly speed and resource consumption.

If you need speed you should delegate it to the client. Basically you are using the user’s computer as a resource for your website. With the caveat that if you push too much to the user you will freeze his browser.

Use server side when you need security(there is no such thing as client-side security) or leveraging background processes, database access, etc

Client side comes at a cost for the user.
Server side comes at cost for you and your hosting.

Do you mean custom functions as native components for example written in PHP and then etappen for easy calling in Wappler?

Or just predefined server connect actions for reuse as a single new action?

JonL it remind me a little of “Snippets” ( reusable codes) in DW it was very useful for me but what you suggest is even better and more advanced and I think it would a great tool : Voted! :slight_smile:

1 Like

A component/server-action that facilitates calling custom client/server functions.

Server Connect Example:

  1. Database connection
  2. Database query -> Output(text)
  3. Custom function:
    Input type: text
    Input: Output of 2.
    Function: jonlcomplexcheck.php
    Output type: boolean
    Output: complexCheck() return;
  4. If (3.output == true)
    Database insert -> whatever

Same idea but for an App Connect Component but with JS

Still have hard time to understand the example… is this something you can’t do now?

Or you mean you can do it but want to save it as function and reuse later?

Say I want to use a rss parser on the server or a custom encryption/decryption using libraries not supported by Wappler.

What I am suggesting is creating sort of a middleware action/component that facilitates translating input from Wappler into my custom snippet and return the custom snippet output to Wappler to use in next steps or other parts of Wappler.

So yes. The main purpose is to be able to build things that are currently not possible or complicated with Wappler but still have an easy way to integrate them in Wappler by leveraging input coming from Wappler and returning the result to Wappler to use it in further steps/places.

The server regex feature request is also a good example. We just need to create myregex.php or myregex.asp files and we could push into our script input data coming from Wappler and return the result so it is also usable in wappler in other steps.

1 Like

Another example of why this feature could be useful and facilitate things.

What you are referring to is actually custom Server Connect action steps.

We will see if we can open up and describe the extensibility that we already have in place for Server Connect, so that people can indeed make their own custom actions.

Server Connect Actions are constructed in a vast structure, in the supported server language. So if you have knowledge in programming, those should be easy to build.

Same is also for App Connect and the client side extensibility. App Connect components have also a standard structure and can be easily build or extended.

So when we finalize all the base functionality we will be opening up more extensibility features,

Wappler is build for extensibility so we have took special care it is as extensible as possible from the ground up.

4 Likes

Yes. That! I didn’t want to use the word extensibility or plugin because of the connotations but that’s exactly what I meant. Wappler extensibility.

I was checking yesterday the Medium editor implementation and saw on a high level how you guys use it.

Glad to know it is scheduled to be delivered at some point in the future.

1 Like

@George was this ever done? We need to work out how to call a custom PHP library from Server Connect so that we can use Server Connect to perform all the queries etc, then call a custom function with a query object.

This seems quite a fundamental requirement, but from reading the many posts on the forum about this, it’s not available still?

You can check this:

@George, I would suggest merging the other feature request with this one - Ability to run PHP script on the server action (Very Useful)

Definitely sounds like a plugin builder of sorts, as mentioned in Allow custom Flow components :smiley:

1 Like

It doesn’t need to be a plugin builder - we just need to be able to call custom PHP libraries. Yes, a plugin builder would also do this, but that sounds like more work to allow the plugin to integrate with the UI etc, while just providing the ability to call a PHP function from a flow seems a lot simpler (to me at least).

IMHO this is really a major limitation with Wappler and seriously reduces its usefulness.

:beers:

2 Likes