SAP Builders Discussions
Join the discussion -- ask questions and discuss how you and fellow SAP Builders are using SAP Build, SAP Build Apps, SAP Build Process Automation, and SAP Build Work Zone.
cancel
Showing results for 
Search instead for 
Did you mean: 

But where do I use this variable?

J-Luc
Explorer

Hi,
I tend to make somewhat huge applications and I'm looking for an efficient method to integrate comments into SAP Builder logic... I already had this problem with AppGyver... and another problem is finding or a Variable is used in a page or in an app.
Do you have an idea for a solution or otherwise, thank you guys at SAP for thinking about that... This is a huge limitation of your solution as soon as the application becomes huge!
Thanks

12 REPLIES 12

Tinashe_Mukombe
Explorer

I haven't yet come across a way to annotate or comment on logic added within the logic canvas so perhaps somebody else has an ideal answer to this question or perhaps I haven't understood it correctly. 

However to answer your second question: There are a few ways to tell if a page or app variable has been used. If a variable is assigned to a property or layout, The first indication on weather or not its a page or app variable is the icon. 

Screenshot 2024-03-18 at 7.55.04 PM.pngPage variables have an icon that resembles a 'paper' or 'file' with a chain link protruding from the middle heading outwards to the right. Additionally hovering above a property that is assigned to the variable will also highlight what the property is bound to. So in the screenshot to the right of this text, the variable is currently bound to a page variable

 

Screenshot 2024-03-18 at 7.55.17 PM.pngApp variables have an icon that appears to be resembling the screen of a mobile device combined with a chain link as in the screenshot to the right. Additionally hovering above a property that is bound to a variable will also indicate weather or not its an app or page variable 

 

Lastly if you select a property that is bound to a variable and switch it to binding type: formula, You can identify a key difference which is that app variables will always start with appVars.example while page variables will be labeled as pageVars.example within the formula binding type. To clear any doubts over any variable you have, you could simply type the name of the variable in formula binding and see if it begins with appVars or pageVars. Below are some examples of an app variable named DeviceTokenScreenshot 2024-03-18 at 8.13.33 PM.png

 

 and page variable named DailyTemp within formula binding  Screenshot 2024-03-18 at 8.13.59 PM.png

Hopefully this answers your second question and all the best with your project!

 

 

0 Kudos

thank you but in fact the problem is rather in the other direction, when I have dozens of variables in the page variable list for example, the idea and to know if they are used and in what logic.

Well for this I have not yet found a proper solution. There is one workaround, but that still won't help you find the variable in the UI. What I do sometimes is copy the page (or just an element) and paste it into an empty component.json file inside visual studio code. It will show you something like this: 

mihalytothnc_0-1710795475697.png

Inside here you can easily use the ctrl+F again, to find a specific pagevariable. This method doesn't really help if you also need to identify where it is as you would be lost in thousands of lines of json on a more complicated page. So I would only use this if you want to check if there is any use of a variable before deleting it. 

Of course this copying of an element allows things like this happen: 
Mevi's selectable calendar component 

No-code expert with extensive experience in SAP Build Apps (former Appgyver), Firebase, Xano. Actively working on a startup and further projects.

0 Kudos

This is a cool tip ... how have you used this capability to help you?

I can see in Mevi's blog it used for some sort of "transport" of pages/components, but anything else?




--------------
See all my blogs and connect with me on Twitter / LinkedIn

Mainly for transportation reasons. 
Let's take a big application for an example. There is one team member who ideates and creates UI prototypes of a component, but doesn't build logic for that component. In order to get the most of the Build Apps Composer he does that in a sample component library mini app. He can see the changes quickly in the preview. When he is done, I just copy and paste that component into our main app and build the required logic for it and then turn it into a custom component. You have pretty good guide of component creation here for reference.

No-code expert with extensive experience in SAP Build Apps (former Appgyver), Firebase, Xano. Actively working on a startup and further projects.

Sounds good... But I don't quite understand how you can copy an element from a logic and paste it into VisualStudio to find the code there ?????

0 Kudos

I'll answer it myself, it's great... It works (even with Notepad++)
But I was unable to copy an entire page... Only one component. If we can copy an entire page to find an abandoned variable that would be great.
Thanks again !

mihaly-toth-nc
Explorer

Hey there, All pretty amazing suggestions above!

I would also like to add my few thoughts on this.

First suggestion that saves me enourmous amounts of time is to acutally use the browsers built in text search, so use the 'ctrl+F' or 'cmd+F' keyboard combination. Then search for the specific variable, component name or similar. This is why the change (that happened a few months ago) that renaming components is pretty easy helped a lot. This method works pretty well, if you need to find styles (and you happen to have many) or if you are in the variable settings screen. 

As for how to document. I tend to just use a 'javascript' custom node which doesn't have an output and the content of it is a comment. I then name it either 'comment' or with some more descriptive name. This way you could in fact position your comments pretty close to where the actual logic happens. See image below: 

mihalytothnc_0-1710792284703.png

 

And then on the inside I have something like this: 

mihalytothnc_2-1710792323775.png

Hope this also gives some useful suggestions.

Best wishes

 

No-code expert with extensive experience in SAP Build Apps (former Appgyver), Firebase, Xano. Actively working on a startup and further projects.

0 Kudos

Great idea for js blocks to write text in 🙂

0 Kudos

Really great idea for the commenting.

1) Can you perhaps add that to the tips discussion, if you haven't already? https://community.sap.com/t5/sap-builders-discussions/what-s-your-favorite-tip-for-using-sap-build-a...

2) I didn't really understand the tip for searching for styles -- how do you find styles? And for searching variables -- do you mean that if I have a Set page variable and I set ABC to something, it shows ABC on the flow function and then I can find that with the browser tools? 




--------------
See all my blogs and connect with me on Twitter / LinkedIn

Dan_Wroblewski
Developer Advocate
Developer Advocate
0 Kudos

This is a general problem with logic, and me and my colleagues were suggesting a place where I can see all my logic -- because I may have a variable that is not acting properly and I want to find all places where it is set, but it is difficult to know where all the logic is hidden. 




--------------
See all my blogs and connect with me on Twitter / LinkedIn

Jakub_Roguski
Product and Topic Expert
Product and Topic Expert

The same issue here. Whenever I change anything in my variables, I start thinking if particular variable is used in any place or not - could I delete it safely or not?  🙂