QueryString problem

This is my database
image

I like to make a query/filter that selects only Boll=1 and ordered by IBollVinstUT with the higest number first.
this is my string
'?$filter=SpelDatum eq ' + QuotedStr('23-10-30') + ' and Bana eq ' + QuotedStr('Fågelbro 18') + ' and Boll eq 1' + '&$orderby=IBollVinstUT DESC'
After setting the Querystring I make a Close and then a Load
But the result are all 7 records and not in the order I want.

According to documentiation, dates should not be quoted. Your query string should be SpelDatum eq 2023-30-10.

I don't know what happens with orderby, have you checked in the browser's network tab how the request is being sent to the server?

It works fine with Date quoted it also works with orderby
BUT
This code works
PROCEDURE TInkaUserMainForm.KR_IBollVinstUT;
VAR

  • s1, s2: STRING;*

  • delamed, antalvinster, peng, spelare, testIID: INTEGER;*

  • isWinner: BOOLEAN;*
    BEGIN

  • delamed := 0;*

  • spelare := 0;*

  • WDS_InkaResult.First;*

  • antalvinster := WDS_InkaResult.FieldByName('IBollVinstUT').AsInteger;*

  • isWinner := (WDS_InkaResult.FieldByName('IndianID')*

  •  .AsInteger = ActivePLayerID);*
    
  • REPEAT*

  •  INC(spelare);*
    
  •  // so we know how many players*
    
  •  IF WDS_InkaResult.FieldByName('IndianID').AsInteger = ActivePLayerID THEN*
    
  •     IF antalvinster = WDS_InkaResult.FieldByName('IBollVinstUT')*
    
  •        .AsInteger THEN*
    
  •        INC(delamed); // if there ar more than one who has the same number*
    
  •  WDS_InkaResult.Next;*
    
  • UNTIL WDS_InkaResult.eof;*

BUT IF ADDING THIS CODE IN THE END OF THE PROCEDURE THE CODE ABOWE GIVS WRONG RESULT
// end with preparing the next calculation

  • s1 := '?$filter=SpelDatum eq ' +  QuotedStr('23-10-30');*
    
  • s1 := s1 + ' and Bana eq ' + QuotedStr('Fågelbro 18');*
    
  • s1 := s1 + ' and Boll eq  1*
    
  • s2 := s1 + '&$orderby=IBollVinstIN DESC';*
    
  • WDS_InkaResult.QueryString := s2;*
    
  • whatsNext := C_KR_IBollVinstIN;*
    
  • WDS_InkaResult.Close;*
    

END;

How is it posibel
I set the Querystring
I run a procedure that uses the dataset and I get al correct data from the dataset
But if I in the end of that Procedure add code that sets a new Querystring then the code before the setting of the new querystring. the dataset in the beginning of the procedure has the wrong data.

Please send a project reproducing the issue. Don't forget that many operations in the dataset are asynchronous, like Dataset.Load. If you modify something immediately after calling load, it will do strange things.

solved this by using 12 different TXDataWebDataSet and then I got the correct data for each of them
Using 1 TXDataWebDataSet and change the Querystr gave unreliable results

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.