2024 Mar 18 4:36 PM
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
2024 Mar 18 7:19 PM - edited 2024 Mar 18 7:25 PM
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.
Page 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
App 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 DeviceToken
and page variable named DailyTemp within formula binding
Hopefully this answers your second question and all the best with your project!
2024 Mar 18 8:33 PM
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.
2024 Mar 18 9:03 PM
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:
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
2024 Mar 19 7:06 AM
2024 Mar 19 8:02 AM
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.
2024 Mar 19 7:24 AM
2024 Mar 19 7:31 AM
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 !
2024 Mar 18 8:06 PM
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:
And then on the inside I have something like this:
Hope this also gives some useful suggestions.
Best wishes
2024 Mar 18 8:33 PM
2024 Mar 19 7:20 AM
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?
2024 Mar 19 7:21 AM
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.
2024 Mar 19 8:04 AM