Project Variables
Global variables are categorized into two types: project and page. Project variables can be used across all pages in a project, improving efficiency and usability when the same variable is needed on multiple pages. Page variables are effective only on the current page.
If a page variable has the same name as a project variable (e.g., ProjectVariable), the page variable takes precedence.
Creating a Project Variable
- Log in to Huawei Cloud Astro Canvas by referring to Logging In to Huawei Cloud Astro Canvas.
- On the Projects page, click a project to access.
- On the main menu, click the Project Settings tab.
- In the upper right corner of the page, click Edit Project to obtain the project editing permission.
- In the navigation pane, choose Project Variables and click New Variable.
- Set parameters for the new variable and click Confirm.
Figure 1 Adding a variable
- Variable: Enter the name of the new variable. The name must start with a letter and can only contain letters and digits.
- Default value: The default value of the variable in a new project.
- Description: The meaning or usage of the variable in a new project.
- Scope: Select the page(s) to which the project variable applies.
- After the setting is complete, click Save.
When creating multiple project variables, click Reorder to adjust the order of the variables. Adjusting the sequence of variables only affects the visual order and does not impact the variables referenced on the page.
Using Project Variables
- Develop a page by referring to Creating a Page.
- On the toolbar in the upper part of the page, click
to view the project variables created in Creating a Project Variable.
If a page variable has the same name as a project variable (e.g., ProjectVariable), the page variable takes precedence.Figure 2 Viewing the project variable - Use the project variable in data or interaction actions.
- Select a widget on the page, click
above the widget, and use the project variable in the widget data.
Figure 3 Using the project variable in the widget data - Select a widget on the page, click
above the widget, and use the project variable in the interaction action.
Figure 4 Using the project variable in the interaction action
- Select a widget on the page, click
- Update the project variable.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot