Android Question Function like "NameOf(variable name)" would be very nice

tito

Member
Licensed User
Longtime User
Hi B4X Team,

I was defining a class with many properties/ variables.
I'm matching them with DB content comming from an json string.

Class Sub:
B4X:
public Sub SetItem(colroot As Map)
    
    id =colroot.Get("id")
    text =colroot.Get("text")
    teilnehmer_id =colroot.Get("teilnehmer_id")
    titel=colroot.Get("titel")
    ...
    ...
    
End Sub

It is working fine but to be more flexible for further changes and also "find all references" it would be very great if there is a possiblity like in Visual Basic to get the variable name as string like:

Visual Basic Code:
B4X:
dim var as string = "blabla"
dim s as string = NameOf(var) 'will return "var"'

I have found some old answers here. Is it still not possible?

Thank you for the awesome B4X tools!!!
 

KMatle

Expert
Licensed User
Longtime User
You can match all columns (if I get you right) with a simple loop trough the map (keys = columns, values=content to be checked) vs. the db's columns/content. You can limit which colum is cheked by a simple array with all the column names to be checked.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…