Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

HTTP_Resource_Services

I am testing the return of only master dict columns, but I am getting all the columns.
Here is the code extract from the last copy I have.
this is and extract from the GetColumnNames paragraph.

If you look at the line:
If Len(ColumnNames) else ColumnNames = Fields

Fields is all the column names.
Shouldn't it be using an array from where the delete(...... is done?

I know I am probably being stupid as usual, but I cant see it working.

Loop Master = Fields<FIELDS_MASTER_FLAG$, FieldPos> Type = Fields<FIELDS_TYPE$, FieldPos> Conv = Fields<FIELDS_CONV$, FieldPos> MV = Fields<FIELDS_MVFLAG$, FieldPos> Pos = Fields<FIELDS_FIELD_NO$, FieldPos> KeyPart = Fields<FIELDS_PART$, FieldPos> GroupName = Fields<FIELDS_MV_GROUPNAME$, FieldPos> If (Master AND Not(Pos EQ 0 AND KeyPart EQ 0)) OR (Type EQ 'S') then // The column must be a Master column (but not a full Key ID) or a Calculated column. If Fields<FIELDS_NAME$, FieldPos> EQ '' then // If the column does not have a name in the FIELDS_NAME$ value (for whatever reason) then // remove it from the array so it will be be included in the final results. Fields = Delete(Fields, FIELDS_FIELD_NO$, FieldPos, 0) Fields = Delete(Fields, FIELDS_PART$, FieldPos, 0) FieldsList = Delete(FieldsList, FieldPos, 0, 0) end end else Fields = Delete(Fields, FIELDS_FIELD_NO$, FieldPos, 0) Fields = Delete(Fields, FIELDS_PART$, FieldPos, 0) FieldsList = Delete(FieldsList, FieldPos, 0, 0) Locate Fields<FIELDS_NAME$, FieldPos> in ColumnNames using @FM setting fPos then ColumnNames = Delete(ColumnNames, fPos, 0, 0) end Until Fields<FIELDS_FIELD_NO$, FieldPos> GT 0 OR (FieldPos EQ 0) FieldPos -= 1 Repeat Fields = SRP_Rotate_Array(FieldsList) If Len(ColumnNames) else ColumnNames = Fields<FIELDS_NAME$>

Comments

  • Ok, Whoops, sorry missed this:
    Fields = SRP_Rotate_Array(FieldsList)

    Ok MY problem must be elsewhere
  • I am really sorry if I am still missing something, but the only way I could get the correct result is to change this:

    *Until Fields GT 0 OR (FieldPos EQ 0)
    Until (FieldPos EQ 0)

    Without the change, would not it be exiting on the first field position found?
  • Sorry, the change should be this:

    FieldPos -= 1
    Until (FieldPos EQ 0)
    repeat
  • Barry,

    I really am not at all clear on what you are asking, assuming you still have a question any more. If you still have an unanswered question please post again as simply as possible.
  • The following code extract is supposed to loop through all the dict fields and create a list of Master fields.
    This was not happening for me.

    I see the problem in here:

    Until Fields GT 0 OR (FieldPos EQ 0)
    FieldPos -= 1
    Repeat

    When the field No is >1 the loop is exited.

    If I change to:

    FieldPos -= 1
    Until (FieldPos EQ 0)
    repeat

    It works as I supposed it should.

    All I am doing is letting you know in case there is a problem with your original code.

    GetColumnNames paragraph

    Loop Master = Fields<FIELDS_MASTER_FLAG$, FieldPos> Type = Fields<FIELDS_TYPE$, FieldPos> Conv = Fields<FIELDS_CONV$, FieldPos> MV = Fields<FIELDS_MVFLAG$, FieldPos> Pos = Fields<FIELDS_FIELD_NO$, FieldPos> KeyPart = Fields<FIELDS_PART$, FieldPos> GroupName = Fields<FIELDS_MV_GROUPNAME$, FieldPos> If (Master AND Not(Pos EQ 0 AND KeyPart EQ 0)) OR (Type EQ 'S') then // The column must be a Master column (but not a full Key ID) or a Calculated column. If Fields<FIELDS_NAME$, FieldPos> EQ '' then // If the column does not have a name in the FIELDS_NAME$ value (for whatever reason) then // remove it from the array so it will be be included in the final results. Fields = Delete(Fields, FIELDS_FIELD_NO$, FieldPos, 0) Fields = Delete(Fields, FIELDS_PART$, FieldPos, 0) FieldsList = Delete(FieldsList, FieldPos, 0, 0) end end else Fields = Delete(Fields, FIELDS_FIELD_NO$, FieldPos, 0) Fields = Delete(Fields, FIELDS_PART$, FieldPos, 0) FieldsList = Delete(FieldsList, FieldPos, 0, 0) Locate Fields<FIELDS_NAME$, FieldPos> in ColumnNames using @FM setting fPos then ColumnNames = Delete(ColumnNames, fPos, 0, 0) end Until Fields<FIELDS_FIELD_NO$, FieldPos> GT 0 OR (FieldPos EQ 0) FieldPos -= 1 Repeat Fields = SRP_Rotate_Array(FieldsList) If Len(ColumnNames) else ColumnNames = Fields<FIELDS_NAME$></div>
  • Barry,

    I think some of my confusion lies in the smaller snippets of code you are putting in your post. Are those exact copies or did you simply type it out? I simply don't see any code that looks exactly like that.

    The larger snippet of code, of course, comes right from the service. With regard to the placement of the FieldPos -= 1 line, it seems like it would be more efficient if it was placed above the Until statement. However, I don't see where the code would fail to provide you with all of your column names. If anything, the loop goes through one more time than it should.
  • Barry,

    Upon reviewing the code again, the original placement of FieldPos -= 1 is by design to properly satisfy the Fields< FIELDS_FIELD_NO$, FieldPos > GT 0 condition. So, perhaps your dictionary poses a unique challenge to the design. If you are willing to ship me a copy of your %FIELDS%, I would be happy to test it.
  • This is a copy/paste from what I thought was the latest code from you.
    Can you send me the latest you have please and I will take a relook.
  • copy of %FIELDS% sent via email
  • this is showing as my http frameworks version:
    2.1.0
    04/11/2016 10:15PM
  • For those monitoring this thread, thanks to Barry's discovery and his %FIELDS% record (which was rather full of all kinds of column goodness), I was able to confirm the issue he brought up. I have updated the GetColumnNames service and it will be released in a new HTTP_Resource_Services module in an upcoming upgrade to the HTTP Framework. There is no scheduled date for this so if anybody just wants a fix for this service, send an email to support@srpcs.com and I'll ship you the source.
Sign In or Register to comment.