Results 1 to 18 of 18

Compare JSON data and splitting into corrected codes, deleted codes and added codes

Threaded View

chandramouliarun Compare JSON data and... 11-29-2020, 11:50 PM
vba_php Re: Compare JSON data and... 11-30-2020, 10:05 AM
chandramouliarun Re: Compare JSON data and... 11-30-2020, 11:26 AM
vba_php Re: Compare JSON data and... 11-30-2020, 11:35 AM
jindon Re: Compare JSON data and... 11-30-2020, 12:54 PM
chandramouliarun Re: Compare JSON data and... 12-01-2020, 02:14 AM
jindon Re: Compare JSON data and... 12-01-2020, 02:19 AM
chandramouliarun Re: Compare JSON data and... 12-01-2020, 02:43 AM
jindon Re: Compare JSON data and... 12-01-2020, 03:22 AM
chandramouliarun Re: Compare JSON data and... 12-01-2020, 04:18 AM
jindon Re: Compare JSON data and... 12-01-2020, 04:43 AM
chandramouliarun Re: Compare JSON data and... 12-01-2020, 05:03 AM
jindon Re: Compare JSON data and... 12-01-2020, 05:09 AM
chandramouliarun Re: Compare JSON data and... 12-01-2020, 05:24 AM
jindon Re: Compare JSON data and... 12-01-2020, 05:40 AM
chandramouliarun Re: Compare JSON data and... 12-01-2020, 05:53 AM
jindon Re: Compare JSON data and... 12-01-2020, 05:59 AM
chandramouliarun Re: Compare JSON data and... 12-01-2020, 06:46 AM
  1. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Compare JSON data and splitting into corrected codes, deleted codes and added codes

    What is the definition of "correctedcode"?

    Try replace "Private Sub GetDetails" with following code and see how it goes.
    Private Sub GetDetails(ByVal txt As String, myKey, dic As Object, flg As Boolean)
        Dim m As Object, e
        With CreateObject("VBScript.RegExp")
            .Global = True
            .Pattern = """description"": *""(.+?)"".*[\r\n]+.*""dCode"": *""(.+?)"""
            For Each m In .Execute(txt)
                If flg Then
                    dic(myKey)(m.submatches(0)) = m.submatches(1)
                Else
                    If dic(myKey).exists(m.submatches(0)) Then
                        If dic(myKey)(m.submatches(0)) <> m.submatches(1) Then
                            dic(myKey)("correctedcode") = dic(myKey)("correctedcode") & _
                            IIf(dic(myKey)("correctedcode") <> "", ", ", "") & dic(myKey)(m.submatches(0))
                        End If
                        dic(myKey).Remove m.submatches(0)
                    Else
                        dic(myKey)("addedcode") = m.submatches(1)
                    End If
                End If
            Next
        End With
        If Not flg Then
            For Each e In dic(myKey)
                Select Case e
                    Case "Billid", "Ctextid", "codername", "correctedcode", "addedcode", "deletedcode"
                    Case Else
                        dic(myKey)("deletedcode") = dic(myKey)("deletedcode") & _
                        IIf(dic(myKey)("deletedcode") <> "", ", ", "") & dic(myKey)(e)
                End Select
            Next
        End If
    End Sub
    Last edited by jindon; 12-01-2020 at 03:27 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Compare JSON data and splitting into corrected codes, deleted codes and added codes
    By chandramouliarun in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-29-2020, 12:06 PM
  2. Added codes to macro and some codes no longer work
    By alisoncleverly in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-14-2020, 01:26 PM
  3. [SOLVED] Convert Y Codes from one column to another based on Unique Codes
    By ashishmehra2010 in forum Excel General
    Replies: 2
    Last Post: 10-06-2015, 09:49 PM
  4. Replies: 7
    Last Post: 08-13-2015, 10:58 AM
  5. Replies: 1
    Last Post: 12-10-2013, 12:28 AM
  6. Replies: 0
    Last Post: 10-09-2013, 07:59 PM
  7. Combining vba codes makes the previous codes broken !
    By MDPLUS in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-26-2013, 10:00 AM

Tags for this Thread

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1