Results 1 to 8 of 8
  1. #1

    Question Null Values in OnUpdate

    Dears,

    we are using this code to subscribe from lightstreamer

    var tableInfo = new SimpleTableInfo("sy1 sy2 sy3 sy4 sy5", "MERGE",
    "adjustedYestClose AskPrice AskVol AvaragePrice"
    , true) {DataAdapter = "PROXY_MarketBeat"};


    _subKey = Tabee3Client.client.SubscribeTable(tableInfo, this, false);

    the lightstreamer returns 2 snapshot the first snapshot have null values in all items in (IUpdateInfo collection) after i ends the lightstreamer send the second snapshot with the values.

    what is the problem and how to solve it?

    Regards,

  2. #2
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    Hi,

    I suspect that in your adapter you declare you have a snapshot in the isSnapshotAvailable method and then you send the first update with the snapshot flag set to false. This will cause the server to consider the snapshot to be made of empty values and thus it will send nulls. After that it sends the first update of your adapter.

    Can you please check?

  3. #3
    Dears,

    I have set

    public bool IsSnapshotAvailable(string itemName)
    {
    return true;
    }

    and this on the sending data to lightstreamer


    _listener.Update("hp" + index.ToString(), eventData, false);

    but it still sending null values in the onupdate method

    Regards,

  4. #4
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    Yes exactly, you specify true in your IsSnapshotAvailable implementation.

    Then you send the update telling the server that what you're sending is not the snapshot:

    _listener.Update("hp" + index.ToString(), eventData, false);

    thus the server creates a snapshot of null values for you and after that sends your update.

    You might either returning false in the IsSnapshotAvailable implementation or set the snapshot flag to true when sending the first update: either case you'll get rid of the null upates.

    HTH



  5. #5
    Senior Member
    Join Date
    Aug 2014
    Posts
    71
    Dears,
    i try all possible values of IsSnapshotAvailable and _listener.Update
    1- true - true
    2- false - false
    3- true - false
    4- false - true

    the 1&2 cases not return null and also not return the snapshot.
    the 3&4 cases return null on first update from lightstreamer.

    what i need is to get the snapshot data on first update

    Regards

  6. #6
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    Case 1 should return the snapshot, case 4 should not return the nulls, can you please double-ceck?

    In any case you can't use a fixed value in the update call:

    you have to return true in the IsSnapshotAvailable and then you have to use true on the first Update call following the subscription of the related item, and use false for every subsequent call until you get the unsubscription for the item. If there is a new subscription call you will repeat the same: true on the first Update false on the subsequent ones

    This demo does that: https://github.com/Weswit/Lightstrea...dapter-dotnet/

    https://github.com/Weswit/Lightstrea...ockList.cs#L62

    https://github.com/Weswit/Lightstrea...ckList.cs#L102

  7. #7
    Senior Member
    Join Date
    Aug 2014
    Posts
    71
    thanks for reply but i try that and result is null or no data on the onupdate()
    i will illustrate my case it may differ and give you example of what happened.
    my adapter sends the updates to the lightstreamer only one time at 3.30 pm then the client open the application at 4.00 pm and subscribe for the items.
    if the client opened the app at 3.30 or befor, the data returned.
    but in my case and when i use true and false cases, data returned null or no data.
    i need if the adapter sends the data only one time to the lightstreamer and then in any after time the client opens the app and subscribe, he can get data correctly.

  8. #8
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    Hi,

    Lightstreamer does not keep the snapshot while no client is subscribed. In your server log you should see the "Unexpected update" message(s) when you issue an update and there are no clients.

    Your adapter should be able to retrieve and send the snapshot when the subscribe method is called (that is the first client is connected). After that the server will handle the snapshot for other clients subscribing to the same item.

    Another, less reliable, option is to keep a fake client always subscribed to your item. You might code it directly into your adapter.

    In any case please take a look to the General Concepts file (section 4), it will probably clear things up for you: http://www.lightstreamer.com/latest/...20Concepts.pdf

 

 

Similar Threads

  1. StaticGrid updates: get old/new values
    By darch in forum Client APIs
    Replies: 0
    Last Post: March 14th, 2013, 02:59 PM
  2. Going back to old values
    By finodex in forum Client APIs
    Replies: 3
    Last Post: September 10th, 2012, 09:47 AM
  3. Formatting of unchanged values in "DynaScrollTable"
    By hofmanna in forum Client APIs
    Replies: 5
    Last Post: January 14th, 2010, 10:02 AM
  4. Are unchanged values broadcasted?
    By Otake in forum Client APIs
    Replies: 2
    Last Post: December 17th, 2009, 02:13 PM
  5. DISTINCT updates are NULL with recent LS server
    By rsouissi in forum Client APIs
    Replies: 4
    Last Post: March 6th, 2008, 01:59 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 07:12 PM.