# If then else - Logic

Hi all,

I want to get ALL “Firmen” items - and want to achive this:

IF current user’s Von PermissionLevel < 100
THEN
unique id = Currrent User’s Von Firma’s unique id [already existing formula - see screenshot)
ELSE
unique id <> 0

Thank,
jupxi

`current user’s Von PermissionLevel < 100`

Just put that as the constraint in your search, then use format as text and add the unique ID accordingly.

Dont have current user in the list:

No… i mean use that as the constraint value.

i.e.

unique id = current user’s Von PermissionLevel < 100: format as text

yes = Currrent User’s Von Firma’s unique id

no =

don’t understand your formula - and it doesnt work.

what is the result for “unique id” in the line:
unique id = current user’s Von PermissionLevel < 100: format as text

Is unique_id the value from Current users Von PermissionLevel
or is it true / false?

What sould I expect with this formula:

I would get ALL Items from Table “Firmen” WHERE unique id = ???

I attempt to explain it again:

I want to get ALL Items from Table “Firmen”
WHERE

→ if Current users’s permissionlevel < 100 then RESULT should be:
ALL ITEMS (complete table) from Table “firmen” (without any where-condition to filter Table “Firmen”)

→ if Current users’s permissionlevel >= 100 then RESULT should be:
ALL ITEMS from Table “Firmen” WHERE Firmen’s unique ID = Current User’s Von Firmen’s unique ID
[this query should give only 1 assigned User’s Von Firmen-Item]

Oh man! It’s not easy to expain what I want. I’m no native english speaker. sorry for that.

best,
jupxi

Evidently…

Yes it does.

It’s whatever you define it as (i.e. `Currrent User’s Von Firma’s unique id`)

I would get ALL Items from Table “Firmen” WHERE unique id = ???

I’m not sure what you mean by that… but you’ll get all items where unique ID is whatever Uinique ID you’ve defined in the constraint (e.g. Current User’s Von Firma’s unique id)

I attempt to explain it again:

I want to get ALL Items from Table “Firmen”
WHERE

→ if Current users’s permissionlevel < 100 then RESULT should be:
ALL ITEMS (complete table) from Table “firmen” (without any where-condition to filter Table “Firmen”)

→ if Current users’s permissionlevel >= 100 then RESULT should be:
ALL ITEMS from Table “Firmen” WHERE Firmen’s unique ID = Current User’s Von Firmen’s unique ID
[this query should give only 1 assigned User’s Von Firmen-Item]

I understand exactly what you’re asking, and the answer hasn’t changed (just be sure to check the ignore empty constraints box if you want to empty unique ID to return ALL items rather than none).

``````

IF (currentUserLevel >= 100) THEN

/*  Comment: Get ALL records from the table */
SELECT * FROM firma;

ELSE

/*  Comment: Get only  records from table where CurrentUsers's-Von Firma's-UniqueID = firma.uniqueId */

SELECT * FROM firma
WHERE firma.uniqueId = currentUsers's.Von Firma.uniqueId

``````

My Database:

Table “users”:

Table “Firma” (english: companies):

user records are linked to companies via uniqueID.

Or you still don’t understand the answer?

If it’s confusing for you, then why not just use a conditional data source instead? (it’s just the same thing done in a slightly different way)

Sounds good!
But how can I do it with a conditional data source?
This is a repeating group.

Just add a condition (or 2), and set the datasource accordingly.

You are the best. I think I did it Yeah !!!

and

That rocks!!!

Why is bubble.io so powerful? No need to code any line any more in future.
Currently I’m creating my first app with bubble.io and within a few days (spend not so much hours) I created a great application.
But I hope that the servicefee (pricing) from bubble for my app will be not to expensive. I want to create 1 app for a lot of users and they work the whole day whith this app. So I have no feeling how much cossts I have to expect.
Is there any possibility to do stress tests with my app, that I can emulate a lot of traaffic and usage for my app?

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.