Jump to content

Passing Tokens to FM?


This topic is 8604 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Is there a way to pass a token from the browser to Filemaker. I have 2 dbs - Users and Products - The user signs in to users which I then get a token from. Then they can view and edit products. What I want to be able to do is let them only see their discounted cost based on their user id.

The only way I've figured to do this is to stay in the User database and create a portal to products with a relationship based on the product code and discount number, but I would like to work directly in the product database and set the token as a global.

Does this make sense?

Link to comment
Share on other sites

First - my apologies -as I did not see the CDML board and this posting is more topical there.

I read the posts there, and I am already passing tokens - but that doesn't help unfortunately, as what I need to do is figure out how to pass a token to filemaker once an action has been completed so that the information found can be customized based on that token, i.e. do a find and then set the value of the token to a global field.

Link to comment
Share on other sites

This sounds like a jod for cookies. Cookies are not hard to implement with CDML, in fact they job is almost trivial since Web Companion takes care of most of the work. The only problem is browser incompatibility handling the cookies...

Link to comment
Share on other sites

You sure can move a cookie directly to FMP -- just like you can a token.

The cookie value is "called" with the [FMP-Cookie: cookiename] CDML tag. To get the value into a FMP database you'd need a form with the CDML tag...

<input type="hidden" name="fieldname" value="[FMP-Cookie: cookiename]">

...or something similar could be done by generating a url directly for people to click on.

Alternativerly the cookie value can be used in a [FMP-If] statement in a custom html format file.

Link to comment
Share on other sites

Try doing it in the database itself, not in CDML. That is, create a calculation field in the db that works out who the current user is (I dunno how you do that over the web with accuracy, passwords perhaps) and take it from there.

Link to comment
Share on other sites

  • 2 weeks later...

shimoda has writter: "I have 2 dbs - Users and Products - The user signs in to users which I then get a token from. Then they can view and edit products. What I want to be able to do is let them only see their discounted cost based on their user id.

"The only way I've figured to do this is to stay in the User database and create a portal to products with a relationship based on the product code and discount number,..."

"- what I need to do though is do a find AND THEN pass the token so that the found records display certain pricing data based on the current user."

The discount number could be a key. If that number is common to a user in User and is common to a price list in Products, you can probably access the Products db through an -inlineaction, by accessing that key number through a -token.

Such syntax might read:

[fmp-inlineaction:-db=Products.fp5,-lay=layoutname,-token=fmp-field:discount_number,-find][fmp-record][fmp-field:item] [fmp-field tongue.gifrice] <br>[/fmp-record][/fmp-inlineaction]

You may not like the display of the results.

FYI, regarding the Form Action entry of the Cookie mentioned above, a similar line of code will get a -token tag from the format file to the database.

If you have successfully designated a -token tag which is a field, the code might read:

<input type="hidden" name="discount_number" value="[fmp-currenttoken:3]">

If you have successfully designated a -token tag which is a -recid, the code might read:

<input type="hidden" name="-recid" value="[fmp-currenttoken:4]">

Hope you find this useful.

Peace

Keith M. Davie

Link to comment
Share on other sites

This topic is 8604 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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