Jump to content
Server Maintenance This Week. ×

Pass parameter to XSLT from script


JMW

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

Recommended Posts

Hi,

 

I'm working on an xslt that will import data into Filemaker

I am working with a single existing record that may or may not contain existing data.

If certain fields contain existing data I do not want to write over them when I import data from the XML file.

So, I would like to pass a value to the xslt that will tell it to skip the data I do not want updated.

Is there a way to do this?

 

Filemaker script:

 

check to see if field has data

if data = true

somehow pass the parameter to the xslt

 

XSLT

 

get the value of the parameter that was passed from the filemaker script

if data = true

   do nothing with xml flags

else

   process flags

 

I can't just put an empty <DATA> tag in the xml because it writes over the existing data.

 

The only way I've found to do this is to use two xslt files.

Id rather not do this because then I have to maintain two of them.

 

Thanks for any help you can provide.

 

 

Link to comment
Share on other sites

Hi,

 

I don't think it's possible, some while ago I did some research on passing data into XSLT and I did not find any suitable solution.

 

I can suggest another way:

write the values you want to keep into global variables and overwrite the field contents you ant to keep after the import.

Link to comment
Share on other sites

I've done it a different way in past.

 

Create another temp table(s) in Filemaker between the XML source and destination FM table(s).  I put my temps in a standalone 'Importer' FM file to keep destination clean.

 

Then can create necessary logic btw the temp holding table(s) and destination table(s) in Filemaker scripting record creation based on whatever logic you want. (Also lets you write checks on data before polluting the main database).

  • Like 1
Link to comment
Share on other sites

Thanks for the information.  At least now I know that it can't be done so I'll stop trying to figure it out.

I've tried a variation of the first suggestion.  I assigned the fields to local variables then ran the xslt.
When I reassign the values of the variables to their respective fields the numbers loose the 0's in the
decimal places.  For example, -2.00 becomes -2.  In my case the decimals are required.

I haven't tried the second suggestion.  I'm wondering if I go to all the work if I'll loose the 0's in the decimals.
So now I have to decide whether I add code to fix the missing 0's or just have two xml files.  I know the easiest
thing to do is have two xml files but I'm not sure it's best from a maintenance standpoint.

Again, thanks for your help.

 

 

Link to comment
Share on other sites

Why are the decimals required?

 

-2 == -2.00 from a mathematical perspective. You can change the display of the field to always show decimals though...

 

Or you can import them to a text field which will preserve information exactly as it is entered - but then makes it more difficult to do any data manipulation in the system.

Link to comment
Share on other sites

-2 == -2.00 from a mathematical perspective
 
This is not true, notably from a mathematical perspective and, I'm pretty sure, not to computers or FM. -2.00 is a real number. It seems a nonsense but 2, as a real number is defined to be 1.999. (That trailing dot should be higher, signifies recurring). 2 is a natural number or integer.
 
Anyone who has worked with financial calculations extensively will have run into the problem of multiple rounding where the answer, occasionally, is a penny out. Computers treat integers differently to floats. A real number, in computer internals, is represented as a float. I say 'represented' as real numbers are impossible to write down completely as they imply the concept of recursion. Thus they can never be represented with total accuracy in a computer's circuitry 
Link to comment
Share on other sites

This topic is 4102 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.