Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Portal - CDML Conditinals

Featured Replies

Let me see if I can keep this clear and to the point.

In a database of mine (we'll call it employees.fp5) I have a portal (we'll call it Departments)

Where by each employee has their own record. The portal Departments is used to list all of the departments that employee services. The departments may contain from 0 - 50 different departments kept in another database).

Now on the HTML side of things, I want to test on the Departments portal to see if in fact there are any departments listed.

Here's a sample of what I'm talking about.

[fmp-record]

[fmp-field: namef] [fmp-field: namel]

[fmp-portal: departments]

[fmp-if: field: departments::name .neq.] SHOW THIS CODE

[fmp-else]

SHOW THIS INSTEAD

[/fmp-if]

[/fmp-portal]

[/fmp-record]

What happens is quite strange. Filemaker tests on every record, if the result is TRUE, meaning there is something in the field departments::name then the test works. If the test is false it displays nothing. The "Else" portion of the test doesn't work at all.

If I have 50 records, it will only display the true portion of the test, or nothing at all, for each of the fifty records, no matter what order they are in. I could have record #2, #10, #45, #50 all test positive and return the correct portion of code, but the others will remain only showing the code outside of the test. (in my example the fields name "namef" and "namel".)

Any ideas what's going on?

This just started happening after I upgraded to the most-recent WebCompanion.

Can you test on portals as I have illustrated, or is there a better way?

[ April 19, 2002, 08:36 AM: Message edited by: evildan ]

[fmp-if: field: departments::name .neq.]

Ummmmmmm. .neq. to what?

I've found that portals always have an extra blank row. Hence, an empty portal will still have one row. This will explain why the 'else' is not being executed and the data is blank.

Whenever I use scripts, for processing portals, I always disregard the last row. (Keith, I do not use these with WebCompanion.)

Hope this helps.

Garry

From CDML reference:

[FMP-If: ClientUserName .neq.]

Everyone who has entered a user name will see this message.

[/FMP-If]

wink.gif

From cdml reference

"Syntax

[FMP-If: LeftSide Operator RightSide ]

..."

...

"Parameters

...

"Numeric comparisons (only with eq, neq, gt, gte, lt, lte)

Field: Field Name - Name of a field to compare with, should be a number

Literal Numeric Value - A number"

__________________

"[fmp-if: field: departments::name .neq.]

"Ummmmmmm. .neq. to what number?"

[ April 20, 2002, 08:56 PM: Message edited by: Keith M. Davie ]

  • Newbies

.neq. = Not empty

from cdml reference

"If [FMP-If]

...

"Parameters

...

"Second parameter: The comparison operator

...

".neq. - not equal to"

quote:

Originally posted by Anatoli:

From CDML reference:

[FMP-If: ClientUserName .neq.]

Everyone who has entered a user name will see this message.

[/FMP-If]

wink.gif

I still do not know why this is not OK with you, Keith?

I am using that in all solutions. In computer logic is many such abbreviations which do work nicely.

It is like in DOS to delete all files one would type del *.*

In fact the shorthand for this is del .

In similar logic is working the CDML IF and it is in CDML reference database.

  • Author

I don't see the problem with using:

[fmp-if: field: Relation::fieldName .neq.]

statement

[fmp-else]

statement

[/fmp-if]

I realize the question that pops in your mind is not equal to what?

But the reference guide uses this as a way to test for an empty field (text AND numaric).

That being said, this doesn't bring me closer to the solution.

How would you do it Keith? I only ask you becuase your reply seems to imply that there I have incorrectly coded the page, what is the correct code then?

This is straight out of crazy town, there should be a solution.

evildan, I had written the following while the forums were being renewed. I think you may find something useful here.

Anatoli, let's start with the excerpt from evildan's original posting of code. "[fmp-if: field: departments::name .neq.]"

Anatoli, you cited this line of code from the cdml reference, "[FMP-If: ClientUserName .neq.]"

Seeing what you wrote I went to the cdml reference and responded with other information.

Now you inquire, "I still do not know why this is not OK with you, Keith?"

It is not a matter of what is or is not OK with me, I don't personalize it. It is a matter of what the cdml reference says and what works.

In the cdml reference following "Notes about literal values", some Syntax examples are presented, including three Text examples.

The third Text example is the example you presented and uses two stated parameters. This example is for the FMP-ClientUsername. The fmp-clientusername refers to and calls the name previously entered into the Password box. This Password box is part of Web Security.fp_ and comes into use when a username other than "all users" is defined and a password is determined for that username. Fmp-clientusername normally is not found in the databases otherwise created for and used in the solution.

The second Text example, like evildan's code, uses a field name as the first parameter, and not one of the reserved words like ClientUsername. Additionally the syntax shows that evildan has erred by including "Field:"

After reconsideration of his original code I now conclude that evildan is trying to check the field (departments::name) to see if it contains data.

I imagine that evildan, wizard that he is, has by now seen the error of his syntax and resolved the issue. He probably used either:

[fmp-if: departments::name .cn. ""]

or:

[fmp-if: departments::name .ncn. ""]

So I've looked at what the cdml reference says; and as to what works I have used the second choice (with a different field name) successfully. It did not display the desired text when written without the quotes:

[fmp-if: departments::name .ncn.]

But that may have been because I did not reverse that text which I wanted to display.

Perhaps evildan will tell us what he did to be successful.

Dan,

Will there ever be a portal row where the 'department::name' is blank?

Garry

  • Author

Keith,

Thanks for including the last post of yours, I did find your post useful. I did not find the error in my code until just today. I was stuck on the fact that it worked using previous versions of the Web companion.

I ended up using your second example "[fmp-if: departments::name .ncn. ""]" which works fine.

I appreciate your postings and wizard-like comments.

evildan, you're welcome. Glad to be of help.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.