Skip to main content
April 18, 2009
Question

Creating conditionals with FDK

  • April 18, 2009
  • 1 reply
  • 597 views

Hi All;

Long time, no post. 😉

Hey, this is probably a long shot but what the heck.  If you don't bet, you can't win.  One of my coworkers is trying to use the FDK to generate conditional paragraphs (or other tags).  He's been entirely unsuccessful despite the fact that he's following the examples given in the doc.  I promised to post here just on the off-chance we can solve this, so here's his email to me......

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Here’s the passage from the FDK Programmer’s Reference that holds the key to my question for the user’s group (please excuse the ugly formatting):

F_ApiSetInts() Sets an F_IntsT property.

Synopsis

#include "fapi.h"

. . .

VoidT F_ApiSetInts(F_ObjHandleT docId,

F_ObjHandleT objId,

IntT propNum,

F_IntsT *setVal);

Arguments

F_IntsT is defined as:

FA_errno value Meaning

FE_BadDocId Invalid document ID

FE_BadObjId Invalid object ID

FE_BadName Specified name is illegal

FE_WrongProduct Current FrameMaker product doesn’t support the operation

docId The ID of the document, book, or session containing the object whose property you

want to set

objId The ID of the object whose property you want to set

propNum The property to set (for example, FP_InCond)

setVal The F_IntsT structure to which to set the property

FDK Programmer’s Reference 289

F_ApiSetInts()

2

typedef struct {

UIntT len; /* Number of IntTs */

IntT *val; /* Array of IntTs or F_ObjHandleTs */

} F_IntsT;

Returns

VoidT.

If F_ApiSetInts() fails, the API assigns one of the following values to FA_errno.

Example

The following code sets the condition for text added at the insertion point to Comment:

. . .

F_ObjHandleT docId, commentId;

F_IntsT conditionIds;

/* Get ID of Comment tag in current document. */

docId = F_ApiGetId(0, FV_SessionId, FP_ActiveDoc);

commentId = F_ApiGetNamedObject(docId, FO_CondFmt, "Comment");

conditionIds.val = (IntT*) &commentId;

conditionIds.len = 1;

/* Set document’s type-in condition property to Comment ID. */

F_ApiSetInts(FV_SessionId, docId, FP_InCond, &conditionIds);

. . .

See also

“F_ApiGetInts()” on page 130.

Basically, I have tried the example and many, many variants but, even in the best case, I get error msg:

#define FE_NameNotFound       -20   /* Can't find object with requested name */

And this I get even when I have verified that the condition text “Internal” exists…

Thanks for the help,

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

David Blyth (UNIX and vi Dinosaur)

Sr. Staff Technical Writer

QUALCOMM  - Standard Disclaimers Apply

Only 149,999,949 more years of Ruling The Earth to go

--------------------------------------------------------------------

    This topic has been closed for replies.

    1 reply

    April 18, 2009

    Sorry, I forgot to add that we're currently working with FrameMaker 8 as we must be compatible with 400+ Frame8 UNIX users.  Adobe, please support Frame9 on UNIX!!

    David Blyth (The UNIX and vi dinosaur)

    Sr. Staff Technical Writer

    QUALCOMM - standard disclaimers apply

    Only 149,999,949 more years of Ruling The Earth to go

    --------------------------------------------------------------------

    Legend
    April 20, 2009

    Hi David,

    It is a little tough to follow that sample from the manual, and in lieu of spending the time to look it up, let me say that I've never had any trouble assigning conditions, at least on Windows. Here is the basic flow I use:

    F_PropValsT propVals;

    F_IntsT condIds;

    F_TextRangeT tr;

    F_ObjHandleT docId;

    ... /* some code here to get the doc ID and populate 'tr' with the text range that you want to conditionalize */ ...

    ... /* Also, some code to populate 'condIds' with valid condition object IDs */ ...

      //set up the PropValsT structure

      propVals.propIdent.num = FP_InCond;
      propVals.propVal.valType = FT_Ints;
      propVals.propVal.u.isval = F_ApiCopyInts(&condIds);

      //Apply the condition(s)

      F_ApiSetTextPropVal(docId, &tr, &propVals);

      /* Note: if you are conditionalizing a table row instead, you'll

       * need the row ID and do something like this:

      *

      * F_ApiSetInts(docId, rowId, FP_InCond, &condIds);

      */

      F_ApiDeallocatePropVal(&propVals);
      F_ApiDeallocateInts(&condIds);

    Hope this helps some.

    Russ