Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Hi.

I'm trying to export data from an existing system to another one. I read somewhere that the FMPDSORESULT is deprecated so I want to use FMPXMLRESULT.

All fields in both system have different name. e.g. in the FM system the last name field is lastName and in the target system it is personLastName.

Since FMPXMLRESULT separate the structure from the data, how can I get the FM field name position from the structure?


...

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="lastName" TYPE="TEXT"/>

...

<COL><DATA>Smith</DATA></COL>

...





I would like to convert to the following format





<personLastName>Smith</personLastName>

So like I wrote I would like to get the position of lastName to be able to retrieve the right data column.

Thanks for any help

Posted

I'm actually in development phase. So the field order is always changing while developing, modifying, testing, ...

In XSL, position() returns the current position, but I need something like "indexOf("lastName")".

Posted (edited)

I'm actually in development phase.

So the field names will not be changing?

---

BTW, I wouldn't take FMPDSORESULT being deprecated too seriously; IIRC, it's been that way since v.7. OTOH, I might be proven wrong within the next 10 days...

Edited by comment
Posted

No, the field names are already set in both system. The order of exportation could change because I'm creating a layout specially for this purpose. I just added a few fields for testing and after I get to know how it works, I will all the necessary fields (500+).

10 days... interesting :)

Posted

You can calculate the ordinal number of the lastName field as =

count(fmp:FMPXMLRESULT/fmp:METADATA/fmp:FIELD[@NAME='lastName']/preceding::fmp:FIELD)+1

Posted

Thanks! I found a similar solution.


<xsl:key name="kValues"

    match="/fmp:FMPXMLRESULT/fmp:METADATA/fmp:FIELD"

    use="following-sibling::fmp:FIELD/@NAME"

/>

 

  <!-- separate templates increase readability -->

  <xsl:template match="/fmp:FMPXMLRESULT">

<xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">

<form1>

    <subform>

	  <xsl:for-each select="/fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW" >

	    <personLastName><xsl:value-of select="fmp:COL[count(key('kValues', 'lastName')) + 1]" /></personLastName>

...

	  </xsl:for-each>

    </subform>

  </form1>

Posted

Question for an old hand! ;)

Having a huge number of fields and knowing FMI deprecated FMPDSORESULT.

Would it be preferable to use FMPXMLRESULT over FMPDSORESULT for a new solution?

Thanks

Posted

I'm just concern that I don't want to restart over again, but as you wrote a lot of developer used FMPDSORESULT.

Thanks

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