What is Page variables and all these page ,string ,bh,bh.input, bh.local,string ,as it ,page

I have used and worked with it , But i am confused about these variable ,why do we have as it and string . Is string to store as string and “as it” can be any number it can be ,is it like that . These variables cannot be console logged or displayed, I can display as page.firstname but not those variables so what is the purpose of it . It would be nice to get a good description about everything and how to use these page variables

1 Like

When I am taking an Input only “page.” is working for me rest bh.input(which i think should support as it is input that i want to store ) is not working for me

2 Likes

hi @AdithyaSiva,

It seems like you are talking about the “Page Variables” node.

This node is used to set or get the page variables

So, if you want to set a page variables for example userName on the page variable, you can set the value in an On Init flow and access it later in any other flow or in the HTML of the page as page.userName.

When you are setting that variable (page.userName) the node provides you the option to map it from other variables.

For the screenshot you have posted, the equivalent code is:

page.fn = page.firstname
page.asd = "asdsadasdsa"

bh, bh.input, bh.local

  • Allows you to map from bh flow variables
  • For example, consider you have made a http call to fetch the list of documents in your flow and you want to map the result to a page.documents variable, assuming that you have mapped the result to bh.local.result. In this case, you would type documents in the left field and select bh.local on the right side and type result.documents

page

  • same as above

string, number, boolean

  • If you select this as the type, whatever you type in the adjacent inputfield will be considered as the respective :link:primitive values

as is

  • The value typed is assigned to the page. variable as Javascript expression without coercing into any type
  • Example, if you type formState select as is and type { isDirty: false}, would be equivalent to this:
page.formState = {
    isDirty: false
}
/**
 * !!!!instead, if you had choosen `string`, it would be: 
 * page.formState = "{ isDirty: false}" // notice the double quotes
 *
 */

Lastly,

You might be thinking that I can do the same in Script. That is correct, but using this node provides more visual information when you are looking at the flow.

3 Likes

ohh i understand it now , Why do we have bh.input and bh.local and normal bh, does it serve any other purpose, or it is just a name conversion . As long as i understood bh is a global object right , where is this bh located and stored , same with page . (in code), and when do we use bh and when do we use page

2 Likes
  1. bh - is an object created at the start of every flow (Start, On Init, Catch etc). bh has input, local, system etc properties. If you set any property on bh.local or bh.input object, it is only available in that flow and not in any other flow
  2. page - is an object created when a page is created. Unlike bh, the same reference of the page is shared and is accessible across all flows and UI of that page

Along with bh, we have also added bh.input and bh.local in the options for conviniency

So if we add bh.local or bh.input inside page variables it is completely useless right , That flow ends there and I cant access neither use it anywhere right, because that flow ends there.

1 Like

wait we can get variables as well right , so in a flow we can add page variables again and get variables right , is that how we can get the variables

1 Like

Because the page. variable reference is shared throughout all the flows and html, whatever gets assigned in one flow can be accessed in other flows and html too

1 Like

@doomedCode
There is still some confusion regarding the bh. Here’s a scenario:
Say we have a service, and the response obtained from the service is saved in bh.local.results. If I need to consume these values on the UI page.:
How do we map the individual response? Please provide an example or some screenshots

@doomedCode @Muhseena_T @ragesh-a please help

You can assign bh.local.results to page.results like page.results = bh.local.results in the page flow.
Then, you can access this page variable in the UI editor like {{page.results}}.

2 Likes

Suppose i have a service, and the response is saved in “bh.local.results”. and i have a separate UI application where i will create a client service and make a Http call, how do i map each key values which will return from service,

for example: how to map below key values to UI page ex:long_name,short_ name and all key values

“address_components”: [
{
“long_name”: “Bengaluru”,
“short_name”: “Bengaluru”,
“types”: [
“locality”,
“political”
]
},
{
“long_name”: “Bengaluru Urban”,
“short_name”: “Bengaluru Urban”,
“types”: [
“administrative_area_level_3”,
“political”
]
},
{
“long_name”: “Bangalore Division”,
“short_name”: “Bangalore Division”,
“types”: [
“administrative_area_level_2”,
“political”
]
},
{
“long_name”: “Karnataka”,
“short_name”: “KA”,
“types”: [
“administrative_area_level_1”,
“political”
]
},
{
“long_name”: “India”,
“short_name”: “IN”,
“types”: [
“country”,
“political”
]
}
],
“formatted_address”: “Bengaluru, Karnataka, India”,
“geometry”: {
“bounds”: {
“northeast”: {
“lat”: 13.173706,
“lng”: 77.8826809
},
“southwest”: {
“lat”: 12.7342888,
“lng”: 77.3791981
}
},
“location”: {
“lat”: 12.9715987,
“lng”: 77.5945627
},
“location_type”: “APPROXIMATE”,
“viewport”: {
“northeast”: {
“lat”: 13.173706,
“lng”: 77.8826809
},
“southwest”: {
“lat”: 12.7342888,
“lng”: 77.3791981
}
}
},
“place_id”: “ChIJbU60yXAWrjsR4E9-UejD3_g”,
“types”: [
“locality”,
“political”
]
}
],
“status”: “OK”
},
“redirectList”: ,
“requestDuration”: “444.688”,
“bytesRead”: 3755
}

@Eldho
Can anyone provide sample SSD POC? it will really help us to get some insights

I dont think bh is made to share data , through multiple pages. you probabily need a service to share data between pages. Bh and pages is for accessing data through multiple flows.

3 Likes

@doomedCode any possibility?

is it possible to share any POC/project file where we can check the code and get more understanding, this will really help us to understand more on SSD