Create assets REST

Hi all

I have problems to create an asset using the REST Api.

I can´t define the relationship parent dimension by using this code:

It works very well

Dimension DimensionValue = new DimensionValue();

dimension.setGroup ('local');

dimension.setName ("en_US");

dimension.setAssettype ("Dimension");

dimension.setId(12345678L);

asset.getDimensions () .add (dimension); well what an AssetBean

I need set the parent, but this code does not work... What is the problem please!

DimensionValue dimParent = new DimensionValue();

dimParent.setGroup ('local');

dimParent.setAssettype ("RRTT_FA"); It's the asset with the settings regional en_US. My asset parent (master asset)

dimParent... setId(123456789L). / / code of basic assets

asset.getParents () .add (dimParent);

I have problems with the stringList data attributes using this code:

Attribute attr = new Attribute();

Data attrdata = new Data();

attr.setName ("attribute name");

attdata.setStringList("Asset:assetid");  I have ´ve had this error: setStringList method is undefined for the type Attribute.Data...

Which is the way to set this attribute?

< attribute >

name of the attribute < name > < / name >

< data >

assettype:assetid < stringList > < / stringList >

< / data >

< / attribute >

And the last one... The blob those:

I use this code, but I can´t see the blob in assets:

Blob BLOB object = new Blob();

blob.setFilename ("filename");

blob.setFoldername ("foldername");

blob.setHerf ("hrer");

Insert the BLOB data

Attribute attr = new Attribute();

Data attrdata = new Data(),

attr.setName ("attribute name");

attrdata.setBlobValue (blob);

asset.getAttributes () .add (attr);

I haven´t received the error to do this, but I can´t see the blob in the WebCenter content management...

Please, I need help with this!

Thank you very much!!

Hello Elena,

Try to clear the parents size before adding a new. And you must add it to the DimensionParents, not the Parents:

DimensionValue dimParent = new DimensionValue();

dimParent.setGroup ('local');

dimParent.setAssettype ("RRTT_FA"); It's the asset with the settings regional en_US. My asset parent (master asset)

dimParent.setId(123456789L); / / code of basic assets

asset.getDimensionParents () .clear ();

DimensionParents Asset.Get () .add (dimParent);

I hope this helps.

Kind regards

Stephan.

Tags: Fusion Middleware

Similar Questions

  • API for creating assets

    Hello everyone,
    This is the API that I used for creating assets in R12.2 version:
    ---------------------

    -set serveroutput on;

    DECLARE

    l_trans_rec FA_API_TYPES.trans_rec_type;

    l_dist_trans_rec FA_API_TYPES.trans_rec_type;

    l_asset_hdr_rec FA_API_TYPES.asset_hdr_rec_type;

    l_asset_desc_rec FA_API_TYPES.asset_desc_rec_type;

    l_asset_cat_rec FA_API_TYPES.asset_cat_rec_type;

    l_asset_type_rec FA_API_TYPES.asset_type_rec_type;

    l_asset_hierarchy_rec FA_API_TYPES.asset_hierarchy_rec_type;

    l_asset_fin_rec FA_API_TYPES.asset_fin_rec_type;

    l_asset_deprn_rec FA_API_TYPES.asset_deprn_rec_type;

    l_asset_dist_rec FA_API_TYPES.asset_dist_rec_type;

    l_asset_dist_tbl FA_API_TYPES.asset_dist_tbl_type;

    l_inv_tbl FA_API_TYPES.inv_tbl_type;

    l_inv_rate_tbl FA_API_TYPES.inv_rate_tbl_type;

    l_return_status VARCHAR2 (1);

    number of l_mesg_count;

    l_mesg varchar2 (4000);

    BEGIN

    dbms_output. Enable (10000000);

    FA_SRVR_MSG. Init_Server_Message;

    -info desc

    "- l_asset_desc_rec.asset_number: = ' 1234567 ';

    l_asset_desc_rec.tag_number: = ' Vedic12345-2';

    l_asset_desc_rec.Serial_number: = ' VEDIC3567-2';

    l_asset_desc_rec.in_use_flag: = 'YES ';

    l_asset_desc_rec.new_used: = "NEW";

    l_asset_desc_rec.owned_leased: = "OWNER";

    l_asset_desc_rec.current_units: = 1;

    l_asset_desc_rec. Description: is "2 OFFICE of BUENOS AIRES".

    l_asset_desc_rec.asset_key_ccid: = 3;--3

    -Cat Info

    -Valid value in FA_CATEGORIES

    l_asset_cat_rec.category_id: = 5; -197

    -type info

    l_asset_type_rec.asset_type: = 'CAPITALIZED ';

    -Property financial information-

    l_asset_fin_rec.set_of_books_id: = 1;

    l_asset_fin_rec.date_placed_in_service: = TO_DATE('25-SEP-2006','DD-MON-RRRR');

    l_asset_fin_rec.deprn_start_date: = TO_DATE('25-SEP-2006','DD-MON-RRRR');

    l_asset_fin_rec.deprn_method_code: = 'STL'; - STL

    l_asset_fin_rec.life_in_months: = 240;

    l_asset_fin_rec.original_cost: = 50000;

    l_asset_fin_rec. Cost: = 50000;

    l_asset_fin_rec.prorate_convention_code: = 'FOL-MONTHS ";

    l_asset_fin_rec.salvage_type: = 'AMT "; -PCT - percentage

    l_asset_fin_rec.salvage_value: = 1000;

    l_asset_fin_rec.percent_salvage_value: = NULL;

    l_asset_fin_rec.depreciate_flag: = 'YES ';

    l_asset_fin_rec.orig_deprn_start_date: = TO_DATE('25-SEP-2006','DD-MON-RRRR');

    -info deprn

    l_asset_deprn_rec.set_of_books_id: = 1;

    l_asset_deprn_rec.ytd_deprn: = 20000;

    l_asset_deprn_rec.deprn_reserve: = 20000;

    l_asset_deprn_rec.bonus_ytd_deprn: = 0;

    l_asset_deprn_rec.bonus_deprn_reserve: = 0;

    -Book / trans info

    -Valid value in FA_BOOK_CONTROLS

    l_asset_hdr_rec.book_type_code: = 'OPS CORP.;

    -info distribution

    l_asset_dist_rec.units_assigned: = 1;

    -Valid registration of other Code GL with record type = 'E' (fresh)

    l_asset_dist_rec.expense_ccid: = 14652;

    -Valid value in places of FA

    l_asset_dist_rec.location_ccid: = 824;

    l_asset_dist_rec.assigned_to: = NULL;

    l_asset_dist_rec.transaction_units: = l_asset_dist_rec.units_assigned;

    l_asset_dist_tbl (1): = l_asset_dist_rec;

    -call api

    () FA_ADDITION_PUB.do_addition

    -settings std

    p_api_version = > 1.0,

    p_init_msg_list = > FND_API. G_FALSE,

    p_commit = > FND_API. G_FALSE,

    p_validation_level = > FND_API. G_VALID_LEVEL_FULL,

    p_calling_fn = > null,

    x_return_status = > l_return_status,

    x_msg_count = > l_mesg_count,

    x_msg_data = > l_mesg,

    -api settings

    px_trans_rec = > l_trans_rec,

    px_dist_trans_rec = > l_dist_trans_rec,

    px_asset_hdr_rec = > l_asset_hdr_rec,

    px_asset_desc_rec = > l_asset_desc_rec,

    px_asset_type_rec = > l_asset_type_rec,

    px_asset_cat_rec = > l_asset_cat_rec,

    px_asset_hierarchy_rec = > l_asset_hierarchy_rec,

    px_asset_fin_rec = > l_asset_fin_rec,

    px_asset_deprn_rec = > l_asset_deprn_rec,

    px_asset_dist_tbl = > l_asset_dist_tbl,

    px_inv_tbl = > l_inv_tbl

    );

    -dump messages

    l_mesg_count: = fnd_msg_pub.count_msg;

    If l_mesg_count > 0 then

    l_mesg: = Chr (10) | substr (fnd_msg_pub.get

    (fnd_msg_pub. G_FIRST, fnd_api. G_FALSE),

    1, 250);

    dbms_output.put_line (l_mesg);

    because me in 1... (l_mesg_count - 1) loop

    l_mesg: =.

    substr (fnd_msg_pub.get

    (fnd_msg_pub. G_NEXT,

    fnd_api. G_FALSE), 1, 250);

    dbms_output.put_line (l_mesg);

    end loop;

    fnd_msg_pub.delete_msg ();

    end if;

    If (l_return_status <>FND_API. G_RET_STS_SUCCESS) then

    dbms_output.put_line ('FAILURE');

    on the other

    dbms_output.put_line ('SUCCESS');

    dbms_output.put_line ('ASSET_ID:' | to_char (l_asset_hdr_rec.asset_id));

    dbms_output.put_line ('ASSET_NUMBER:' | l_asset_desc_rec.asset_number);

    end if;

    end;

    /

    In the end, I get successfully creating assets:

    SUCCESS

    ASSET_ID: 118656

    ASSET_NUMBER: 118656

    But when I ask in both front end and back end, that I can't see, please suggest me if Miss me something...

    Select * from FA_ADDITIONS_B where asset_number = '118656'

    Did you not want to commit?

    p_commit -Online FND_API. G_FALSE,.

    See you soon,.

    Vignesh

  • No templates found when creating assets

    As an administrator, I have created a new model, definition of flex.

    As a contributor trying to create assets in Flex, it doesn't show any model. Gives a message "no templates found. Why do not the created model.

    NoTemplate.PNG

    Have you selected the correct use of the model? Find you it in the second tab (use the tab drop-down element).

    Kind regards

    Ravi G

  • Unable to create assets

    Hi all

    I'm not able to create assets including the assets of page as well as my flex property.

    I am getting below error while trying to save the asset.

    "Could not perform this operation"

    You don't have the required permissions to perform this operation.

    Object must be assigned to the current user before edit is allowed.
    "


    I assigned all roles/ACL for the site and the user trying to create assets.


    Can someone please tell me what am I doing wrong or what I'm missing here? Thanks in advance.


    Kind regards

    Praveen




    Can - as it has to do with a workflow you may have configured in your installation for this type of site and assets?

  • File error REMAINS when creating binding REST (OSB 12 c)

    I want to create a REST in OSB service. I have the bar proxy service in the composite right click and arrived to the REST binding wizard. My steps are:

    -Changed the path of the default resource at /inspections

    -Click above to 'add the operation binding '.

    -Define the noun and the verb (GET)

    -On the answer, I have only selected JSON and define the schema of my custom (below) diagram

    -J' generated a load of the sample and the file is correct

    -J' clicked on OK to return to the wizard REST binding, and then click on OK again and I get this message:

    Cannot write the file REMAINS

    file: /home/oracle/jdeveloper/mywork/OracleAuditSB/InspectionBackend/Resources/InspectionService.wadl

    Exception = space of invalid names http://WADL.dev.Java.NET/2009/02 for xmlns prefix

    The same exception appears in the log. I use JDeveloper 12.1.3

    Schema:

    <? XML version = "1.0" encoding = "UTF-8"? >

    " < xsd: Schema container = ' http://www.w3.org/2001/XMLSchema "xmlns =" " http://www.example.org "

    " targetNamespace = ' http://www.example.org/inspections "elementFormDefault ="qualified"> "

    < xsd: import, schemaLocation = "Inspection.xsd" namespace =" " http://www.example.org "/>

    < xsd: element name = "control" >

    < xsd: annotation >

    < xsd: documentation > a part of the sample < / xsd: documentation >

    < / xsd: annotation >

    < xsd: complexType >

    < xsd: SEQUENCE >

    < xsd: element name = "inspection" type = "inspection" minOccurs = "0" maxOccurs = "unbounded" / >

    < / xsd: SEQUENCE >

    < / xsd: complexType >

    < / xsd: element >

    < / xsd: Schema >

    It turns out that I had to update my version of Jdeveloper. I used 12.1.3 (140505). The 140521 version is fixed.

  • Creating asset - do not fill column subtype in the database table

    Hello

    I'm having a conclusion active problem newly created in the donor, which means that I can't use in other assets.

    What I found that new capital recently, do not have the subtype column overflows into the database. I think that might have effects in the content tree, but I can't even find in the search without any filter bar.

    This is the screenshot of the table filtered by flextemplateid:

    Tablea.png

    And here are the results of research, that I get when I search in the content also filtered by flextemplateid tree:

    lista.png

    As you can see, those with the correctly filled subtype is indicated.

    Someone knows why this phenomenon happens?

    What can I do to fix this?

    Thank you

    Mariana

    I could finally see my newly created goods. That's what I did:

    Tab admin - configure global search

    and then I have re-indexed the assets that I needed.

    He fixed it.

  • Error when creating discs of recovery on HP Pavilion p7 - 1147 b Win7

    While creating the 2nd day of ea 3. system recovery discs, I get an error message during the "check disk" which terminates the process.  I use high quality DVD + R 4.7 gb discs and have tried several brands.  I had the same problem on the 1st disk, but he finally finished after 3 attempts - now I can't get the 2nd drive over to get to the final.  The DVD burner seems to work very well for other applications. I really want to buy these HP recovery disks.

    Hello

    Try to create the rest of recovery disks in Mode safe mode as follows.

    Shut down the PC.  Tap away at f8 that you start the PC to enter the Windows Recovery Console.  Use the arrow keys to select Safe mode and press ENTER.  When windows has fully loaded into this mode, launch the recovery disk Creator application and see if you can complete the creation of your disks in this way.

    To exit Safe Mode, just restart the PC and Windows will start normally.

    If it still does not create a viable set of recovery disks and you are within your warranty period, call HP (phone numbers are on the link below) and explain that the Recovery Media Creator application fails to create a viable set of recovery disks and ask them to send you a free replacement set.

    If you live in the United States, contact HP here.

    If you are in another part of the world, begin here.

    Kind regards

    DP - K

  • How to dynamically create action item?

    Hi, I want to dynamically create point.

    Before I want to create using qml, but does not seem possible

    http://supportforums.BlackBerry.com/T5/Cascades-development/how-to-create-action-item-of-page-dynami...

    So maybe better to use C++ to create dynamically,

    I'm already try but are still not

    So I have a custom control qml (a Navigation pane)

    name List.qml

    the structure is like this:

    NavigationPane {}

    {Page}

    objectName: myPage

    {Of container

    ....

    }

    }

    }

    How to add action item to this .qml?

    I'm already try that, but failed

    C++ :

    Engine QDeclarativeEngine;

    QDeclarativeComponent component(&engine,QUrl::fromLocalFile("List.qml"));)

    QObject * object = component.create ();

    Page * myPage = object->findChild ("Edit");  Maybe, on that note, I'm wrong implemented? -> not found?

    ActionItem * action1 = ActionItem::create () .title ("first action");

    my page-> addAction (action1, ActionBarPlacement:nBar);

    Remove the object;

    How to create this dynamic Action item?

    Help, please

    Thank you

    Hello

    QML, the object name must be included between "" marks.

    Name of the object of your Page will be:

    objectName: "myPage"
    

    You can reach any CPP QML object like this:

    This excerpt comes from YourProjectName.cpp

    // create scene document from main.qml asset
    // set parent to created document to ensure it exists for the whole
    // application lifetime
    
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    
        // create root object for the UI
        AbstractPane *root = qml->createRootObject();
        // set created root object as a scene
        app->setScene(root);
    
    //and here comes the findChild method
    Page* qmlPage = root->findChild("myPage");
    

    After this, you can create any object on the side of C++ QML, as your own code:

    ActionItem* action1 = ActionItem::create().title("First action");
    myPage->addAction(action1, ActionBarPlacement:nBar);
    

    Don't have no need to create a QObejct, or declarative stuff.

  • App works perfectly well on the Simulator (using all modes) and peripheral when z10 in the communiqué of the execution and debug mode. But creates a 'SIGSEGV = 1 fltno = 11 ip = 781722ec error code' when the term is used.

    My application switches between two documents qml is a home page, and the other is actually a video player. Whenever I press the button to go to the video page, it crashes on my z10 and generates the error «terminated code SIGSEGV = 1 fltno = 11 781722ec = ip...» ". But on the Simulator, it works (without of course plays video). When I use the race version and the debug mode, it works perfectly on my z10.

    This problem occurs frequently when I add a new code element. First of all, it happened when I added a scrollview and container, and it's happening now again when a defined a struct in the header file.  It would be nice to ignore this problem? or y at - it some deeper underlying problem which is the cause

    Just tried, I received the SIGSEGV error too, it looks like parent to AbstractPane fixed it.

    void ApplicationUI::changeScene(const QString& newQmlFileName) {
        // Create root object for the UI
        QmlDocument *qml = QmlDocument::create("asset:///" + newQmlFileName).parent(this);
        qml->setContextProperty("_app", this);
        AbstractPane *root = qml->createRootObject();
        root->setParent(this);
    
        // Set created root object as the application scene
        Application::instance()->setScene(root);
    }
    

    My test project is also attached to this message.

  • Build failed if create an InvokeManager

    In the construction of the class, if I again create the InvokeManager, the construction process will be to be failed. It shows only a Red Cross in the project.  There is not any suspicion of error by which I can know what is the problem.

    If I delete the source line ", m_invokeManager (new InvokeManager (this))"in Gateway.cpp, everything is OK. "

    I need to put in place the other libraries in the project or is linked with permission?

    Thank you

    The source code is as below:

    Gateway.HPP

    // Default empty project template
    #ifndef Gateway_HPP_
    #define Gateway_HPP_
    
    #include 
    #include 
    
    namespace bb { namespace cascades { class Application; }}
    
    /*!
     * @brief Application pane object
     *
     *Use this object to create and init app UI, to create context objects, to register the new meta types etc.
     */
    class Gateway : public QObject
    {
        Q_OBJECT
    public:
        //Gateway(bb::cascades::Application *app);
        Gateway(QObject *parent = 0);
        virtual ~Gateway() {}
    private:
        // The central object to manage invocations
        bb::system::InvokeManager* m_invokeManager;
    };
    
    #endif /* Gateway_HPP_ */
    

    Gateway.cpp

    // Default empty project template
    #include "Gateway.hpp"
    
    #include 
    #include 
    #include 
    #include 
    
    using namespace bb::cascades;
    using namespace bb::system;
    
    /*Gateway::Gateway(bb::cascades::Application *app)
    : QObject(app)*/
    Gateway::Gateway(QObject *parent)
        : QObject(parent)
        , m_invokeManager(new InvokeManager(this))
    {
    
        // create scene document from main.qml asset
        // set parent to created document to ensure it exists for the whole application lifetime
        QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    
        if (!qml->hasErrors()) {
    
            // The application NavigationPane is created from QML.
            NavigationPane *navPane = qml->createRootObject();
    
            if (navPane) {
                qml->setContextProperty("_navPane", navPane);
    
                // Set the main scene for the application to the NavigationPane.
                //app->setScene(navPane);
                Application::instance()->setScene(navPane);
            }
        }
    }
    

    The console log

    C:\bbndk\host_10_0_9_404\win32\x86\usr\bin\ntoarm-ld: note: '_ZN2bb6system13InvokeManagerC1EP7QObject' is defined in DSO C:/bbndk/target_10_0_9_1673/qnx6/armle-v7/usr/lib/libbbsystem.so.1 so try adding it to the linker command line
    make[1]: Leaving directory `C:/bbndk/workspace/Gateway/arm'
    C:/bbndk/target_10_0_9_1673/qnx6/armle-v7/usr/lib/libbbsystem.so.1: could not read symbols: Invalid operation
    cc: C:/bbndk/host_10_0_9_404/win32/x86/usr/bin/ntoarm-ld caught signal 1
    make[2]: *** [o.le-v7-g/Gateway] Error 1
    make[1]: *** [debug] Error 2
    make: *** [Device-Debug] Error 2
    

    As the beginning of your state of errors, you must link against libbbsystem.so.1.

    This is done by adding the following line to your .pro Momentics file:

    LIBS += -lbbsystem
    
  • Access a drop-down list component created in fom runtime C++

    Hello everyone.

    I included a file "Settings.qml" as a ComponentDefinition in my file "main.qml" as follows:

    *******************************
    main.qml
    *******************************
    
    Page {
        id: page
    
        //App menu
        Menu.definition: MenuDefinition {
            settingsAction: SettingsActionItem {
                title: "Settings"
                imageSource: "asset:///icons/ic_settings.png"
                onTriggered: {
                    var settings = settingsSheet.createObject(_cam);
                    settings.open();
                }
            }
        }
    
        //Main container
        Container {        Camera {            id: cameraQML            objectName: "cameraQML"        }    }
    
        //Attached objects
        attachedObjects: [
            //*****this is the component definition****
            ComponentDefinition {
                id: settingsSheet
                source: "Settings.qml"
            }
        ]
    }
    

    Then, in the "Settings.qml" file, I have something like that.

    On the crack of onCreationCompleted I call you access of wich C++ function to the cameraQML component and gets the available resolution values and add them to the drop down list component.

    ***********************Settings.qml***********************
    
    Sheet {
        id: settingsSheet
        objectName: "settingsSheet"
        peekEnabled: true
        content: Page {        Container {            DropDown {
                    title: "Capture Resolution"
                    objectName: "resolution"
    
                    options: [
                        Option {
                            text: "16:9"
                            value: 16/9
                        }
                    ]
    
                    onCreationCompleted: {
                        _cam.loadResolutionValues();
                    }
    
                    onSelectedValueChanged: {
                        //_cam.selectResolution(selectedValue);
                    }
                }
            }    }}
    

    The PROBLEM comes when I try to access the menu item drop down because, even if I get error when you call the function findChild(), I do when I try to add Options by calling the add() function:

    ******************applicationui.cpp******************
    
    AbstractPane* root;Camera* cameraQML;DropDown* resolutionsDD;
    
    void AppliactionUI::ApplicationUI() {    //code...    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);    qml->setContextProperty("_cam", this);    root = qml->createRootObject();    cameraQML = root->findChild("camera");    //code...}void ApplicationUI::loadResolutionValues() {
        QVariantList reslist = camaraQML->supportedCaptureResolutions(CameraMode::Photo);
                    //**I don't get error by calling this function
            resolutionsDD = root->findChild("resolution");
    
            //**The app do crashes when calling any of these three functions
        //resolutionsDD->setTitle("Choose an option");        //resolutionsDD->removeAll();
        //resolutionsDD->remove(resolutionsDD->at(0));    for (int i = 0; i < reslist.count(); i++) {
            qDebug()<<"QVatiant value:"<add(Option::create().text(res.width()+"x"+res.height()).value(reslist[i]));
        }
    }
    

    I thought it was a problem with the type of value, I was put in the service. value() when you create an option, but then I realized that, while trying to change the title from the drop-down list, or delete i ' ts options that the application crashed also.

    This makes me think that the problem is that I'm not a correct reference for component drop-down menu QML due to the fact that this drop-down list does not exist when the application starts and is created until the user opens the Settings.qml file. Also, I think that this is a problem with all that stuff parent and child, but of course, it's just a feeling.

    I'd really appreciate your help on this type of problem. I'm not experienced enough to know what is the right way to get a reference of work to the drop down list component in question in a situation like this

    Thank you very much in advance!

    P.D. I'm sorry, I know that my English is not very good. Hope you do not misunderstand

    Hello
    Very probably findChild returns NULL and a NULL pointer dereference causes the crash. I remember there was problems with findChild during the use of the leaves.

    Try from the drop-down list directly to the function as an argument:

    (1) in applicationui.cpp:

    After:
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    
    Add:
        // This is needed for passing DropDown in function parameters from QML to C++
        qmlRegisterType("bb.cascades", 1, 0, "DropDown");
    

    (2) modify the function declaration for:

    Q_INVOKABLE void loadResolutionValues(bb::cascades::DropDown *dropDown);
    

    (3) in QML:

    DropDown {
      id: dropDown
      ...
      onCreationCompleted: {
         _cam.loadResolutionValues(dropDown)
    
         // _cam.loadResolutionValues(this) // maybe this will also work, but I haven't checked
    
      }
    }
    
  • Created in the ListView lost when C++ ListItem custome context reference

    Hi all

    I have a listview that generates a list of the custome listviewItems (ie the containers). Containers have a setContextProperty to my database object. But when they are added to the list view, I can't access the database context property. I realize that the listview is not in the same context as the page but I don't understand why when I bind context for the real item the reference he lost?

    Error: asset:///WorkoutListItem.qml:17: ReferenceError: can't find variable: _Dal

    List.QML

    
    Page
    {
    Container { ListView { id: workoutList horizontalAlignment: HorizontalAlignment.Fill
    
     dataModel: _Dal.ListofWorkouts listItemComponents: [ ListItemComponent {  type: "item" WorkoutListItem { workoutId: ListItemData.id workoutName: ListItemData.name } } ] }//End List }//End root
    }//EndPage
     
    

    WorkoutListItem.qml

    
    Container { id:root property int workoutId: -1 property variant workoutName: ""
    
     layout: StackLayout { orientation: LayoutOrientation.LeftToRight }
    
     Button { id: workoutDelete text: "Delete" onClicked: { var result = _Dal.DeleteWorkout(root.workoutId) } }
    
     Label { id: workoutNumberLabel text: root.workoutId }
    
     Label { id: workoutNameLabel text: root.workoutName }
    
     Button { id: workoutEdit text: "Edit" onClicked: { //TODO: Open workout page } }}
     
    

    application.cpp

    
    QmlDocument *WorkoutListItem = QmlDocument::create("asset:///WorkoutListItem.qml").parent(this);
    WorkoutListItem->setContextProperty("_Dal", dal);
    

    Thanks in advance for any help

    -J

    itemRoot.ListItem.view.yourFunction(ListItemData)
    

    yourFunction (data) is defined in the ListView itself

    from there, you have access to your context

  • Cannot use the context property in a page created from an another qml with createObject()

                        gestureHandlers: [
    
                            TapHandler {
    
                                onTapped: {
                                    var page = infoPage.createObject();
                                    taskCont.ListItem.view.pushNewPage(page); //this pushes page to navigationPane (function at top of qml)
    
                                }
    
                                attachedObjects: ComponentDefinition {
                                    id: infoPage;
                                    source: "asset:///taskInfo.qml"
                                }
                            }
                        ]
    

    This is how I created the page of 'taskInfo. In the PRC, I registered a context property that I am able to access it from the current page but not in 'taskinfo. "gestureHandlers: []" is "listItemComponents".

    I expect to access the object of 'taskInfo' is because I am able to access it from another page created the same way.

    Here's how to register the context property.

    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
    
    mainModel = new ListModel();
    qml->setContextProperty("Model" , mainModel);
    

    OK, I found my problem.

    The reason why he doestn can't work because the page is pushed out "main.qml".

    This is part of my main.qml

    Container {
                id: main_content
    
                TaskList {
                }
    
            }
    

    TaksList is another qml file. When I createObject from this qml file, somewhy context property is not trafered to this object.

    I've found a workaround. I created a function in main.qml and only now I create object, so the contextproperty is transferred

  • Create a border using nine image slices

    Hello! I am trying to create a border using nine slices image.

    selectedControlBorder.png is 12 x 12 px png where means 4 pixels are transparent:

    selectedControlBorder.amd:

    #RimCascadesAssetMetaData version=1.0
    source: "selectedControlBorder.png"
    sliceMargins: 4 4 4 4
    

    Load with this code:

       Container *container = Container::create()
                .layout(new StackLayout)
    [...]           .add(ImageView::create("asset:///images/other/selectedControlBorder.amd")
                      .preferredSize(500, 500))
    

    When it is rendered, it looks like some kind of anti-aliasing is applied. Anyone know why this happens and how to avoid this? Thank you!

    Seems margins are off by 1 px.
    "sliceMargins: 5 5 5 5 ' works.

  • destroy the page created with C++

    Hello

    How do I destroy a thrust from a NavigationPane page when the page is created with C++.

    Here is the code:

    // applicationui.cpp
    
    Page* ApplicationUI::doLoadPageDetails(QString fn) {
    
      QmlDocument *qml = QmlDocument::create("asset:///PageDetails/PageDetails.qml").parent(this);
     [...]  Page *newPage = qml->createRootObject();
    
      return newPage;
    }
    

    When I open the app displays a ListView. When I push on one of the elements in the list the PageDetails page is shown.

    // main.qml
    
    [...]onTriggered: {
                        var selectedItem = dataModel.data(indexPath);
    
                        var page = app.doLoadPageDetails(selectedItem.toString());
    
                        navigationPane.push(page);
    }
    

    Now, I have written a delete action in the application.cpp

    void ApplicationUI::popFinished(bb::cascades::Page* page) {
        delete page;
    }
    

    and used in the main.qml in onPopTransitionEnded:

    onPopTransitionEnded: {
            // Destroy the popped Page once the back transition has ended.
            app.popFinished(page);
        }
    

    But it's not destroy the page. Can someone tell me how to get destroyed page when you press the ButtonBack?

    The count method gave me what I expected when I start the application number is 1-> home page.

    When I click on an item on the next page open-> count = 2.

    When I come back-> count = 1.

    But I solved the problem.

    The second page is filled with information from functions in C++. So in my additional popFinished function on page "Delete" now also clear the list of contacts with the clear function, as I said before.

    void ApplicationUI::popFinished(bb::cascades::Page* page) {
        Contacts.Clear();
        delete page;
    }
    

Maybe you are looking for